summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2003-02-04 11:33:09 +0000
committerache <ache@FreeBSD.org>2003-02-04 11:33:09 +0000
commitabdc3744fad5258534cc778e35e5fdf43a8616cd (patch)
tree961100e9eb2b8dff7b14ae8d86dbbe604151f7f2
parent406a1bc7bbfd2c7d241946c23ede8ec59fd436e2 (diff)
downloadFreeBSD-src-abdc3744fad5258534cc778e35e5fdf43a8616cd.zip
FreeBSD-src-abdc3744fad5258534cc778e35e5fdf43a8616cd.tar.gz
Drop NSHUFF values right after srandom() to remove part of seed -> 1st
value correlation. Correlation still remains because of algorithm limits.
-rw-r--r--sys/libkern/random.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/libkern/random.c b/sys/libkern/random.c
index 1145a84..e390cde 100644
--- a/sys/libkern/random.c
+++ b/sys/libkern/random.c
@@ -36,13 +36,19 @@
#include <sys/libkern.h>
+#define NSHUFF 100 /* to drop part of seed -> 1st value correlation */
+
static u_long randseed = 1;
void
srandom(seed)
u_long seed;
{
+ int i;
+
randseed = seed;
+ for (i = 0; i < NSHUFF; i++)
+ (void)random();
}
/*
OpenPOWER on IntegriCloud