Reputation: 381
What is the best non-deterministic way to generate large random numbers? I wrote a code to generate large numbers using a time function, but it is deterministic.
Upvotes: 0
Views: 872
Reputation: 226296
On Linux machines /dev/urandom
is a source of non-deterministic random numbers.
Another technique is to download some non-random material from the internet (news articles, stock quotes, etc); compress them (using zip or somesuch); then encrypt them with good encryption software (such as AES). The resulting stream of bytes is random (for most practical purposes).
Upvotes: 1
Reputation: 1223
It's much safer to use a random number generator provided by your OS or your programming language. It's really hard to write a random number generator that doesn't produce any discernable patterns.
And as drdwilcox said above, you can't have a truly non-deterministic random number generator unless you have truly random input, which requires some kind of hardware.
Upvotes: 1
Reputation: 3947
Have a look at
http://en.wikipedia.org/wiki/Hardware_random_number_generator
Upvotes: 1