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

Vincent Hanquez tab at snarc.org
Wed Nov 28 23:00:22 CET 2012

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.


More information about the Haskell-Cafe mailing list