# A Million Random Digits with 100,000 Normal Deviates

This Month Stack Overflow 2

A million random digits.

A fun side note - read the reviews of this book:

https://www.amazon.com/Million-Random-Digits-Normal-Deviates/dp/0833030477

this isnt particularly related but i always like pointing out rand's most popular ever publication

Before random number generators, there used to be a giant book that had pages and pages of large numbers sorted in random order. The reviews for it on Amazon are pretty silly: https://www.amazon.com/Million-Random-Digits-Normal-Deviates/dp/0833030477

You could use this code sample: http://xkcd.com/221/ Or, you can use this book: http://www.amazon.com/Million-Random-Digits-Normal-Deviates/dp/0833030477

But seriously, don't implement it yourself, use an existing library. You can't be the first person to do this.

Aloha!

By manually do you mean "not using computer" or "write my own code"?

IF it is not using computer you can use things like dice, numbers in a bag and all those methods seen on telly when they select teams, winning Bingo series etc. Las Vegas is filled with these kinds of method used in processes (games) aimed at giving you bad odds and ROI. You can also get the great RAND book and turn to a randomly selected page:

http://www.amazon.com/Million-Random-Digits-Normal-Deviates/dp/0833030477

(Also, for some amusement, read the reviews)

For writing your own code you need to consider why not using the system provided RNG is not good enough. If you are using a modern OS it will have a RNG available for user programs that should be good enough for your application.

If you really need to implement your own there are a huge bunch of generators available. For non security usage you can look at LFSR chains, Congruential generators etc. Whatever the distribution you need (uniform, normal, exponential etc) you should be able to find algorithm descriptions and libraries with implementations.

For security usage you should look at things like Yarrow/Fortuna the NIST SP 800-89 specified PRNGs and RFC 4086 for good entropy sources needed to feed the PRNG. Or even better, use the one in the OS that should meet security RNG requirements.

Implementation of RNGs can be a fun exercise, but is very rarely needed. And don't invent your own algorithm unless it is for toy applications. Do NOT, repeat NOT invent RNGs for security applications (generating cryptographic keys for example), at least unless you do some seripus reading and investigation. You will thank me for it (I hope).

Given the tone of so many of these reviews, I can't tell if the first reviewer ("Obi Wan") is being serious/delusional or if s/he's using the pagination of the text to subtly(?) mock the other reviewers. https://www.amazon.com/Million-Random-Digits-Normal-Deviates...