>
> Yeah, I've been looking through that few times. Last time had to provide
> an answer as to which randomisation method (out of standardised ones
> ANSI/IEEE etc) we use - and because we use Random class from the framework
> I went to check on it - and found a comment in there that says
>
> //This algorithm comes from Numerical Recipes in C (2nd Ed.)
>
>
Oh! Hang on ... I remember being curious about how Random worked years ago
and I remember finding the answer right under my nose (where I forgot to
look). The MSDN Random docs tell you:

*The current implementation of the Random class is based on Donald E.
Knuth's subtractive random number generator algorithm. For more
information, see D. E. Knuth. "The Art of Computer Programming, volume 2:
Seminumerical Algorithms". Addison-Wesley, Reading, MA, second edition,
1981.*

Knuth's algorithm has really good behaviour. The C recipes has a handful of
algorithms, the first ones are weak, but the subtractive one is good. I
would feel quite safe using the Random class (except for crypto work of
course). If you want really good (but slower) randomness, use
RNGCryptoServiceProvider.

Greg K

Reply via email to