From: "David Schwartz" <firstname.lastname@example.org>
To: <email@example.com>, "Patrick J. LoPresti" <firstname.lastname@example.org>
Cc: "Linux kernel" <email@example.com>
Subject: RE: /dev/random vs. /dev/urandom
Date: Mon, 10 Jan 2005 11:24:21 -0800 [thread overview]
Message-ID: <MDEHLPKNGKAHNMBLJOLKKEMKAPAB.firstname.lastname@example.org> (raw)
> In the first place, the problem was to display the error of using
> an ANDing operation to truncate a random number.
Except there is no error.
> In the limit,
> one could AND with 0 and show that all randomness has been removed.
Of course. Any time you truncate something, you are removing something from
> However, those who know nothing about the theory would then
> probably jump upon this as a "special case" even though it usn't.
Nope, no special case. Truncate all the way, remove everything. Truncate
part of the way, remove something.
If you have a random number between 0 and 32767, and you want a random
number between 0 and 255, you are going to have to remove some of the
randomness from the input number. So long as the input random numbers are
uniform and the truncation maps the same number of inputs to each output,
any truncation scheme is as good as any other. Specifically, ANDing is as
good as dividing, is as good as any other scheme as far as the quality of
the output is concerned.
Where things get complicated is where the number of possible outputs does
not divide evenly into the number of possible inputs. For example,
truncating a random number between 0 and 32767 to one between 0 and 9. There
are some algorithms to do this, but ANDing is insufficient.
next prev parent reply other threads:[~2005-01-10 19:46 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
2005-01-10 19:24 ` David Schwartz [this message]
2005-01-11 14:38 ` Andrea Arcangeli
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 \
* 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).