Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Since computers work off formulas, without greater knowledge one would assume that it would come up with the same answer for a set formula. However, you're able to tell it to generate a random number. IE: php rand(). What's the formula that's used to get a random number? How can there be anything "random" in an algebraic expression?

Been wondering for a while, hopefully it's not blatantly obvious.

share|cite|improve this question
If you have a formula for randomness, how is it random? Who decides what is random? BTW - I know the answers to these questions. – user94648 Sep 13 '13 at 7:40
up vote 6 down vote accepted

There is a discussion in Wikipedia and many books on the subject. The numbers are deterministic but scattered. You hope that in the ways you use them, they "act like" they are truly random.

share|cite|improve this answer
So based on that article, in essence the first "random" number it uses is the clock in milliseconds. Very interesting. – bradenkeith Jan 19 '11 at 16:34
That is often done, or in most cases you can supply your own seed. That is useful in debugging, so you can make sure you get the same series of "random" numbers. – Ross Millikan Jan 19 '11 at 16:41
A more useful and direct link maybe the article on PRNGs. – Willie Wong Jan 19 '11 at 17:49

There are also hardware circuits that can produce random numbers.

share|cite|improve this answer

Random doesn't exist if two things are done the same way in the same circumstances only the same results can be observed

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.