Jump to content

Something i was always curious about..


alex
 Share

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

Link to comment
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.

Link to comment
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

Link to comment
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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.