1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

srand*dev() fallback code: change ^getpid() to ^(getpid() << 16) to allow

change of high word part too to produce more interesting seed distribution.
This commit is contained in:
Andrey A. Chernov 2001-04-23 10:14:28 +00:00
parent 931c04f1a8
commit 848422bb7d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=75862
2 changed files with 2 additions and 2 deletions

View File

@ -130,7 +130,7 @@ sranddev()
unsigned long junk;
gettimeofday(&tv, NULL);
next = getpid() ^ tv.tv_sec ^ tv.tv_usec ^ junk;
next = (getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk;
}
}

View File

@ -312,7 +312,7 @@ srandomdev()
unsigned long junk;
gettimeofday(&tv, NULL);
srandom(getpid() ^ tv.tv_sec ^ tv.tv_usec ^ junk);
srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk);
return;
}