[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] MiNT random bug and question



Hi !

On Wed, Aug 25, 1999 at 02:24:45PM +1200, Mario Becroft wrote:
> Firstly, I noticed today that the command "cat /dev/random" freezes the
> machine.

Did it really freeze the machine, or did it just stop giving output
after some lines?

> Otherwise maybe /dev/random would work if someone would explain how to
> use it.

/dev/random is used to produce cryptographically secure random numbers,
i.e. there's no way to predict the current state, the next number
returned, nor to reproduce a sequence based on a given state (you could
use it for one-time-pads, for example). For this, the device monitors
several sources of noise (keyboard input, mouse movement, context
switches, etc., though I'm not sure what exactly the MiNT port monitors)
to generate a "pool of entropy". If you read too often from that pool,
its level of entropy will drop too low and /dev/random will block until
it's grown enough to return strong random numbers again.

If you just need "quite good" random numbers (which I guess as you
considered using Random()), switch to using /dev/urandom. This one will
never block, but return cryptographically weak random numbers once the
pool's level of entropy has dropped so far that /dev/random would block.

Note, though, that cryptographically strong random numbers are not
necessarily suitable for things like simulating dice, because their
primary purpose is to generate non-predictable/non-reproducable
sequences of numbers, which may not match your expectation of "real word
randomness".


Ciao

Thomas


-- 
Thomas Binder (Gryf @ IRCNet)  gryf@hrzpub.tu-darmstadt.de
PGP-key available on request!  binder@rbg.informatik.tu-darmstadt.de
Vote against SPAM:             http://www.politik-digital.de/spam/

Attachment: pgpfqC4FtnS2v.pgp
Description: PGP signature