Christopher Coleman-Smith
11/28/2006 6:12:00 PM
why not seed it from /dev/random/ in C/++ you'd do something like this:
unsigned int seed
FILE *devrandom = fopen("/dev/random", "r");
fread(&seed,sizeof(seed),1,devrandom);
then pass the seed to rand, using the time itself is a bit dubious if
you want a strong set of random numbers, not a good idea for statistical
research / cryptography i fear.
Smgspices@aol.com wrote:
> Surely it must be possible to initialize rand with current date and time.
> Documents seem to indicate this is done with rand(0) or srand with no value. I
> have tried both methods and I get the same tired old sequence of numbers. I
> would write my own random number generator except I don't know how to get a
> numeric value out of Time.
>
> Charles Gray
>
>