Ticket #767 (assigned enhancement)
random seed should be more random
|Reported by:||zbigniew||Owned by:|
|Priority:||not urgent at all||Milestone:|
The default RNG is seeded with time(NULL) which only changes every 1 second. See CHICKEN_initialize in runtime.c. Actually it only changes every 2 seconds, as C_randomize expects a C_word and the bottom bit is therefore destroyed. Actually, on most platforms it may take up to a minute to change values, as rand() is crap. Example:
while :; do date; csi -p '(random 60000)'; done
Instead it should be seeded with pid XOR seconds XOR milliseconds. This is totally portable and doesn't involve replacing rand() with random() or anything else disruptive, just seeding with more random bits.
I will put together a patch to do this, it is a trivial fix.