srandom(time()) is too weak even for joke, use srandom(time() ^ getpid())

at least. Note that srandomdev can't be used here since gawk preserve old
seed value.
This commit is contained in:
ache 1997-10-15 22:49:19 +00:00
parent 9bb743990a
commit ad58c6f873

View File

@ -1263,7 +1263,11 @@ NODE *tree;
(void) setstate(state);
if (tree == NULL)
#ifdef __FreeBSD__
srandom((unsigned int) (save_seed = (long) time((time_t *) 0) ^ getpid()));
#else
srandom((unsigned int) (save_seed = (long) time((time_t *) 0)));
#endif
else {
tmp = tree_eval(tree->lnode);
srandom((unsigned int) (save_seed = (long) force_number(tmp)));