CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Frequently Asked Questions:
Why aren't my random numbers random?

 



Jasmine
Administrator

Jan 19, 2001, 2:37 PM

Post #1 of 1 (1492 views)
Why aren't my random numbers random? Can't Post

(From the Perl FAQ)

Why aren't my random numbers random?

The short explanation is that you're getting pseudorandom numbers, not random ones, because computers are good at being predictable and bad at being random (despite appearances caused by bugs in your programs :-). A longer explanation is available on http://www.perl.com/CPAN/doc/FMTEYEWTK/random, courtesy of Tom Phoenix. John von Neumann said, ``Anyone who attempts to generate random numbers by deterministic means is, of course, living in a state of sin.''

You should also check out the Math::TrulyRandom module from CPAN. It uses the imperfections in your system's timer to generate random numbers, but this takes quite a while. If you want a better pseudorandom generator than comes with your operating system, look at ``Numerical Recipes in C'' at http://nr.harvard.edu/nr/bookc.html.



 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives