# Random number generators?

If there is a random number generator, is there a way/program to figure out its algorithm? If so, is it possible to predict what next number would come out next? How complicated would it be if there are numbers between 1-75?

Relevance
• It used to be. The older pseudo random number generators used to use algorithms which could be predicted. If you started with the same seed number, you always got the same sequence of pseudo random numbers. I think some of these implementations are preserved for backwards compatibility.

More modern random number generators try to incorporate some form of "entropy" from the environment to improve randomness.

Here is a pointer to a Red Hat article on random number generators: https://www.redhat.com/en/blog/understanding-rando...

• Login to reply the answers
• The answers so far pertain to the raw output of a random number generator when the generator's algorithm is known--provided that the number returned identifies the internal state of the generator.  That's not the case in modern algorithms--and particularly not so for cryptographically strong generators--but even with a weak generator, adding that "if there are numbers 1-75" requirement makes it essentially impossible.

One of the weakest generators around is the Microsoft implementation of the C/C++ rand() function.  MS decided to keep compatibility with the generator used in early PCs running MS-DOS rather than implement a better algorithm for 21st century processors.  Even so, that distills 32 bits of random number down to 15, and further reducing that to generating numbers from 1-75 and running that a billion times (about a fourth of the possible states) looking for occurrences of a short sequence, came up with the following:

In one run, the three number sequence (17, 23, 49), picked for no good reason, occurred 2365 times, and every number from 1 through 75 came up next multiple times (from 19 minimum to 45 maximum, average 31.5 times).  So, having seen the last 3 outputs of the generator, you have no idea what the next one will be.

That result makes sense statistically,   There are (10^9 - 2) 3-number sequences (allowing for overlap...if elements 1-3 aren't the 3 given numbers; then elements 2-4 might be) and 75^3 = 421875 different 3-value sequences.  You'd expect about 10^9 / 75^3 ~~ 2370 occurrences.

If this wasn't true, by the way, nobody would use the generator.  Correlation among consecutive groups of generated numbers is one of the first things a generator is tested for.

So, if your goal is to predict lottery numbers by looking at past values, think again.  Even if you knew the exact random number algorithm, could guess the starting seed and knew the exact method used to reduce the range to 1-75, AND the generator was a lousy one, you still have no measurable edge.

• K-SiS
Lv 4
3 days agoReport

Although level one no is predictable, you can use that  random no as seed to next level after 3 level it is nearly impossible to reverse engineer. Also the no generated fraction is between 0 to 1 multiplying it by 75 you will get at least 99% accurate random no.

• Login to reply the answers
• That's the key to most codebreaking systems. So, depending on the algorithm used, be prepared to spend a lot of resources on it. And keep in mind that "possible" for a mathematician is different from "possible" for an Engineer.

• Login to reply the answers
• There are a number common algorithms to generate pseudo-random numbers.  Many of them are based on starting with a number based on the current time and date.  The time is down to the microsecond, so it would be difficult to know what the exact time was when the program requested the number to be generated.

But you can write a program that can check several thousand possibilities and check the next number for a given common algorithm, and then the next number.  So, if you get 3 number that match you given that algorithm a high probability of being the one.

Then you can do the same thing for however many common algorithms you can dig up.

On the other hand, there are ways to get truly random numbers from a device that would have to be accessible.  Such a device can get its numbers from radio static.  You won't ever get it to repeat a sequence.

• EddieJ
Lv 7
5 days agoReport

Look on wikipedia

• Login to reply the answers
• Yes, there is a way to figure it out. Yes it is possible to predict what the next number would be by knowing the algorithm. How complicated it would be would depend on how complicated it is to figure out the algorithm and upon doing so how complicated the random number generator's algorithm is as you will have to carry out the functions of that algorithm, either manually or by way of some automated means you would then have to manufacture, each of which would have its own complexities depend on how complicated the algorithm is.

• Jin Soo5 days agoReport

• Login to reply the answers
• Login to reply the answers