Re: An home-made Random Generator



Hi Ross,

I think that to make the distinction of "cryptographically secure" is a bit of a furphy --- Cryptographers are interested in pseudorandom number generators that are fast. Essentially, a stream cipher is a pseudorandom number generator.

The important thing is that the output "looks" random --- that is, it is not predictable and has the statistical properties of a random distribution (but can be replicated by anyone with the key). In this case it is the unpredictability that is important.

Given that, any well designed cipher or hash function will do the job, although I think stream ciphers might be easier to adapt.. I would recommend Rijndael (also known as AES) and RC6. These can be used to generate a stream of zeros and ones, which can be transformed into any number range you need. There is also optimised code available for Rijndael from NIST.

One of my colleagues has written a utility for which always one to specify the range and the type of output. It is then able to generate millions of pseudorandom values in a matter of minutes.

Hope this helps,

Ursus

clemenr@xxxxxxxxxx wrote:

Mainly out of curiousity, when I feel the need to use a "good" random number generator, I usually use the Mersenne Twister. Not because I've researched the properties, but because I've seen it quoted by people as being good, it's fast, and there is no shortage of free code implementing it.

I basically use random numbers for the bootstrap, simple simulations,
permutation tests, etc. I do not as far as I know need a
cryptographically secure random number generator. In fact, for many
quick hacks I just use C's drand48().

Any comments on other random number generators I should look at.

Cheers,

Ross-c

.



Relevant Pages

  • Re: post-doomsday computing
    ... > pseudorandom number generator will likely be cryptographically ... That is not a one-time pad. ... That is simply a stream cipher. ...
    (sci.crypt)
  • Re: Pontential backdoor in NIST PRNG standard
    ... an NIST standard contains a pseudo-random number ... If this generator is used with the constants explicitly recommanded ... The NIST scheme Dual_EC_DRBG needs more than this: ... good idea to generate parameters that are "verifiably pseudorandom": ...
    (sci.crypt)
  • Re: Ive seen things you people wouldnt believe...
    ... The guys who implemented the pseudorandom number generator in Windows came up with sort of an ad hoc, ... But primarily, in order to determine the next numbers being generated by Windows' pseudorandom number generator, you need to determine the state of the pseudorandom number generator. ... Steve: Well, yes, except that you could also constantly be mixing in updates. ...
    (rec.arts.sf.fandom)
  • Re: TML Pascal II Random Number
    ... of them are of low quality and/or low performance. ... the remainder, not the quotient, since the remainder changes most ... "pseudorandom number generator" and program one that fits your needs. ... A good generator will only be one or two lines of code. ...
    (comp.sys.apple2)
  • Re: quick algorithm for random permutation
    ... the [Knuth shuffle] works because, ... sequences generated by a sufficiently pseudorandom generator. ... individual elements to be shuffled are distinct, each sequence will ...
    (comp.theory)