summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2001-04-23 10:14:28 +0000
committerache <ache@FreeBSD.org>2001-04-23 10:14:28 +0000
commit18527260ea1630f7788c53b276584bc6ca0fb06e (patch)
tree4f355ba67381f795790afb4054b769e612f1a399 /lib
parentba96b53461e2b4ea9034c2e532e2abbf478772bf (diff)
downloadFreeBSD-src-18527260ea1630f7788c53b276584bc6ca0fb06e.zip
FreeBSD-src-18527260ea1630f7788c53b276584bc6ca0fb06e.tar.gz
srand*dev() fallback code: change ^getpid() to ^(getpid() << 16) to allow
change of high word part too to produce more interesting seed distribution.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdlib/rand.c2
-rw-r--r--lib/libc/stdlib/random.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/stdlib/rand.c b/lib/libc/stdlib/rand.c
index 8de8ead..314fb92 100644
--- a/lib/libc/stdlib/rand.c
+++ b/lib/libc/stdlib/rand.c
@@ -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;
}
}
diff --git a/lib/libc/stdlib/random.c b/lib/libc/stdlib/random.c
index a271669..fb0aa07 100644
--- a/lib/libc/stdlib/random.c
+++ b/lib/libc/stdlib/random.c
@@ -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;
}
OpenPOWER on IntegriCloud