[Haskell-cafe] How can I avoid buffered reads?

Leon Smith leon.p.smith at gmail.com
Thu Nov 29 00:05:45 CET 2012

If you have rdrand,  there is no need to build your own PRNG on top of
rdrand.   RdRand already incorporates one so that it can produce random
numbers as fast as they can be requested,  and this number is continuously
re-seeded with the on-chip entropy source.

It would be nice to have a little more information about /dev/urandom and
how it varies by OS and hardware,   but on Linux and FreeBSD at least it's
supposed to be a cryptographically secure RNG that incorporates a PRNG to
produce numbers in case you exhaust the entropy pool.

On Wed, Nov 28, 2012 at 5:00 PM, Vincent Hanquez <tab at snarc.org> wrote:

> On 11/28/2012 09:31 PM, Leon Smith wrote:
>> Quite possibly,  entropy does seem to be a pretty lightweight
>> dependency...
>> Though doesn't recent kernels use rdrand to seed /dev/urandom if it's
>> available?   So /dev/urandom is the most portable source of random numbers
>> on unix systems,  though rdrand does have the advantage of avoiding system
>> calls,  so it certainly would be preferable, especially if you need large
>> numbers of random numbers.
> There's no much information on this i think, but if you need large number
> of random numbers you should build a PRNG yourself on top of the best
> random seed you can get, and make sure you reseed your prng casually with
> more entropy bytes. Also if
> you don't have enough initial entropy, you should block.
> /dev/urandom is not the same thing on every unix system. leading to
> various assumptions broken when varying the unixes. It also varies with the
> hardware context: for example on an embedded or some virtualized platform,
> giving you really terrible entropy.
> --
> Vincent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121128/ac7ac280/attachment.htm>

More information about the Haskell-Cafe mailing list