archive mirror
 help / color / mirror / Atom feed
From: "Patrick J. LoPresti" <>
Subject: Re: /dev/random vs. /dev/urandom
Date: 10 Jan 2005 10:13:18 -0500	[thread overview]
Message-ID: <> (raw)

linux-os <> writes:

> In the first place, the problem was to display the error of using
> an ANDing operation to truncate a random number.

In the first place, you began by claiming that the number of zero bits
should equal the number of one bits.  I explained how that was wrong,
and now you are saying you meant something else.

Fine, but you are still wrong; it is not an error to use AND.
/dev/random is just a stream of bits.  Each bit behaves like a coin
toss.  When you group the bits into bytes and then AND each byte with
1, you merely examine every eighth bit and throw away the rest.  Each
bit you examine still behaves just like a coin toss.

So ANDing with 1 produces fine output if you are trying to simulate a
fair coin.  Counter to your original claim, the output of your program
is completely consistent with the theory on this.

> In the limit, one could AND with 0 and show that all randomness has
> been removed.

Since that throws away ALL of the bits, of course it "removes the
randomness".  Yes, each byte from /dev/random is a perfectly random
number between 0 and 255.  If you AND with 1, you get a perfectly
random number between 0 and 1.  If you AND with 0, you no longer get a
random number.  Awesome!

> The short number of samples was DELIBERATELY used to exacerbate the
> problem although a number or nay-sayers jumped on this in an attempt
> to prove that I don't know what I'm talking about.

An impression you are reinforcing with every message.  There is
nothing wrong with the randomness from /dev/random, nor with the
odd/even randomness in your sample program's output.  Other than
"trust me", "try it with a real coin", or "read a book", I am not sure
how to convince you of this...  So I will probably stop trying.

 - Pat

  parent reply	other threads:[~2005-01-10 15:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-07 19:05 /dev/random vs. /dev/urandom Ron Peterson
2005-01-07 19:16 ` Paulo Marques
2005-01-07 19:24 ` Chris Friesen
2005-01-07 19:26 ` Florian Weimer
2005-01-07 19:27 ` linux-os
2005-01-07 19:40 ` Robert Love
2005-01-07 20:50   ` Ron Peterson
2005-01-07 21:39 ` Andries Brouwer
2005-01-07 22:39   ` linux-os
2005-01-07 17:55     ` Michal Schmidt
2005-01-07 23:29     ` Andries Brouwer
2005-01-08 17:34     ` Patrick J. LoPresti
2005-01-10 12:41       ` linux-os
2005-01-10 13:03         ` Paulo Marques
2005-01-10 14:39           ` Felipe Alfaro Solana
2005-01-10 15:13         ` Patrick J. LoPresti [this message]
2005-01-10 19:24         ` David Schwartz
2005-01-11 14:38         ` Andrea Arcangeli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='' \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).