1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-29 12:03:03 +00:00

Tighten up the random seeding a little bit more. getpid() alone only

affect only lower bits of seed which would resulte in the same seed for
sequences of fast-started awk's resulting the same random sequence.

Submitted by:	ache
This commit is contained in:
David E. O'Brien 2001-11-03 02:14:10 +00:00
parent 5daeec1454
commit 9c23373c4e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=85938

View File

@ -1509,7 +1509,8 @@ do_srand(NODE *tree)
if (tree == NULL)
#ifdef __FreeBSD__
srandom((unsigned int) (save_seed = (long) time((time_t *) 0) ^ getpid()));
srandom((unsigned int) (save_seed = (long) time((time_t *) 0)
^ (getpid() << 16)));
#else
srandom((unsigned int) (save_seed = (long) time((time_t *) 0)));
#endif