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:
Andrey A. Chernov 1997-10-15 22:49:19 +00:00
parent d021ae3db5
commit fca096e2e1

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)));