[NCLUG] My attempts using /dev/random...

Chad Perrin perrin at apotheon.com
Sun Apr 13 23:28:00 MDT 2008


On Sun, Apr 13, 2008 at 03:15:59PM -0600, Sean Reifschneider wrote:
> I went ahead and generated a bunch of randomness from /dev/random on
> several different hosts.  My laptop, over the last 4 days or so, didn't
> even get enough randomness for 100,000 rolls of 2 dies (using the mechanism
> suggested by Stephen's research).  The other systems I tried were able to
> get enough randomness for 4 iterations of 100,000 rolls.
> 
> See the README for more details, but I ran this against an OpenSolaris
> (backup1) system, 2 Linux systems with plenty of activity on them (routera
> and mirrors), /dev/urandom on my laptop, and then also a pass running the
> Python random number generator.

Unfortunately, the harsh truth is that both /dev/random and /dev/urandom
are flawed.  They're PRNGs -- they do not provide *true* random numbers.
A greater "randomness" is provided by /dev/random, of course, in that it
uses seeds more, um, strictly (for lack of a better term).  Luckily, I've
written a C function that provides a *true* random number!  Here it is:

    int true_rand()
    {
        return 6;
        /* guaranteed truly random -- determined
        by the roll of an unloaded six-sided die */
    }

You may all thank me, now.

Note that the above function was inspired by xkcd, though I improved upon
the original function by rolling a six-sided die.  I have no proof that
the inspiring function used a truly random number.

    http://xkcd.com/221/

-- 
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
Amazon.com interview candidate: "When C++ is your hammer, everything starts
to look like your thumb."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.nclug.org/pipermail/nclug/attachments/20080413/d6e5f406/attachment.pgp>


More information about the NCLUG mailing list