random-number-generator – How Do Computers Generate Random Numbers

random number generator

This may very well be the only question I ever ask on this stackexchange site. In programming there are many different ways to generate random numbers depending on different languages. What has been bothering me for a while now, however, is HOW can anything computer generated be random? I found this
post however it wasn't very well received and it said to broad or to many possible answers. However the way I see it there is only one possible answer, how it works! I mean to say that someone with a computer background should be able to answer this so it isn't like I am asking for your opinion. As a final note I would like to apologize if I am in the wrong forum.

Best Answer

They can and can't depending on the computer. Usually, it's a pseudorandom algorithm. One of the earliest algorithms was basically just to perform a series of basic arithmetic (multiply, divide, add, subtract, modulo) on a number called a seed, and take the middle numbers, or something like that. The numbers appear random, but after a certain number of trials, the same cycle will repeat itself.

Which means that they can't use a PRNG to encrypt your password. PRNGs usually use the system time as the seed, so if the attacker know the approximate time your password was encrypted (account creation time, password change time), they can just generate a small range of passwords using that time range, and try all the generated passwords instead of having to generate all possible combinations allowed.

If you've ever gone to www.random.org, you'll probably see that they generate truly random numbers. That's because they use devices to collect atmospheric noise, or some kind of noisy atmospheric data, and use that.

I'm not an expert on this, but I think some OSes might also collect data from user's mouse movement and keyboard presses along with a PRNG to generate numbers secure enough to encrypt passwords with

Related Question