[Mono-list] Random

Matthew S. Ford Matthew.S.Ford@Rose-Hulman.Edu
Tue, 31 Jul 2001 13:09:22 -0500

Bob Smith wrote:

> --use-c-rand
> --use-linux-rand
> to select different implementations of the c mono-rand() function that
> the random class would use depending on if the user wants speed, or
> needs precision, or whatever.
I think that we'll basically need both a libc rand() like function and a 
random device.

The libc version is what is referred to as a pseudo-random number 
generator.  On a quick inspection they appear to be random and for many 
purposes, they are.  If you need some numbers to throw into a game are 
need some numbers for your modeling, a PRNG will work fine.

When prodicting what number comes next is worth a significant amount of 
money, then a "truly random" source is needed.  This is usually provided 
by monitoring user input.  Taking the time between key strokes and using 
this to select which number to return is an example of how this can be 

Using a truly random source for everything could drain the source of its 
entropy (randomness) and could case generating truly random numbers to 
be slower due to the system needing to grab more entropy from the user. 
It also cause debugging to be a problem when trying to reproduce an 
error in an application that works with random numbers.

I'm not saying that this work needs done now but just saying that both 
will be needed in the end.


Matthew S. Ford