I saw a video on YouTube recently about generating random numbers, and the fellow who talked about it gave a formula for generating numbers that depend on human input but look random. The forumla was as follows:
(a * x + b)%m
A, x, and b are numbers that the human behind the computer puts in. The “%m” part is modulo division, so you divide the ax+b part by m, your maximum number, and the remainder is your result. For more “random” numbers that really just look more random, you take the result of that formula and replace it with x. I experimented with this in Applescript, and came up with this:
set a to text returned of (display dialog "Set a variable." default answer "300" default button 2) as integer
set x to text returned of (display dialog "Set another variable." default answer "7" default button 2) as integer
set b to text returned of (display dialog "Set a third variable." default answer "13" default button 2) as integer
set m to text returned of (display dialog "Set a maximum." default answer "10" default button 2) as integer
display dialog (a * x + b) mod (m)
display dialog "There was an error in process of generating your psuedorandom number. Please try again."
If you rerun it and put x as the result, again your numbers will look more random. But, since there is a formula, nothing in this is really random.
Logically, m happens to be your maximum number because the remainder of a division cannot be more than the divisor, so play with that.
And, if you run the program several times with the defaults I set, you will always end up with the answer of 3. This is proof that the numbers aren’t really random.
Anybody can use my program anywhere. Thanks for viewing,
In the video I saw, the people in the video actually generated a completely random number by taking the deviation from the mean in terms of electrons released from decaying Strontium. I don’t know how to do it on a computer though.
I am not going to argue whether random numbers exist or not.
You may find it interesting in looking into hashing algorithms, which relies heavily upon random numbers (pseudo :)), there is a slew of cryptographic algorithms which also may be worth while to look into. (Wikipedia for both). sha1, and aes should be interesting to look at while studying random numbers. And just for fun of course. Random numbers are fun!
Another interesting beast, is the Chinese Reminder Theorem.
The time resolution of random number generators are so precise and the machine is controlled by human hand, of course it feels like an true random number. It is actually our randomness in time controlling the computer that generates the random number, not the computer.