# Something i was always curious about..

## Recommended Posts

for all you math and computor geniuses...

this might be worded a bit weird(i'm not the greatest with words...)

how do computors or programming languages come up with/define random sequences?

example:

if i tell a computer or write a program to pick a random positive integer between 1 and 100, what's going on behind the scenes?

i hope my question makes sense.

thanks to anyone with helpful replies...

i've always been curious about this and until now have never really bothered to investigate(feel free to call me a lazy jackass...or whatever)

-alex

##### Share on other sites

whoa...i just changed from a lepton to a quark...

##### Share on other sites

Pseudo-random numbers produced by the standard PC are generated by algorithms, that´s why they are pseudo-random even though the "pseudo" is often omitted. We´ve had several threads about this on SFN in the past so doing a search for the keywords "random numbers" should give some useful results.

##### Share on other sites

i knew they were generated by algorithms...i just wanted to know the specifics behind the algorithms...and what it would take to constitue a "random" number...i guess i should have been more clear.

i'll search for those threads you mentioned.

-alex

##### Share on other sites

Here's a good article.

Other systems simply gather data about various things the computer is doing at the moment - disk access, processor utilization, and various other things that aren't entirely predictable - and create a "pool" of randomness that they can then pick from.

##### Share on other sites

i knew they were generated by algorithms...i just wanted to know the specifics behind the algorithms...and what it would take to constitue a "random" number...i guess i should have been more clear.
Different algorithms create different quality pseudo random numbers. Better quality means you have less chance of predicting what number is going to come up next, without knowing the exact parameters used. Really good quality pseudo random number generators use really long and complicated algorithms that require quite an understanding of discrete mathematics to comprehend.

For example Linear Congruential Generators are fairly simple and can be hacked (predicted) without too much difficulty. You'd use this when high quality randomness is not mission critical such as a random component to some AI or the need for random choices during critical path analysis.

Higher quality pseudo random number generators like Mersenne Twister that Cap'n linked to would be used for scientific research. Such as running a simulation and wanting a fair sample of possible starting variables but not having enough resources for every possible starting variable.

Taking "real data" like the time, the core processor temperature et cetera might sound like a good idea at first but it is completely useless when debugging needs to be done and you want to run the program exactly the same way again.

##### Share on other sites

thanks for the replies and links guys

-alex

## Create an account

Register a new account