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:
parent
931c04f1a8
commit
848422bb7d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=75862
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user