aboutsummaryrefslogtreecommitdiff
path: root/lib/random.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-11-12 17:02:17 -0800
committerBen Pfaff <blp@nicira.com>2010-11-15 09:32:58 -0800
commit7918636f05b058cf621cca1e6772e427b5eb736e (patch)
treebe3f4711ed0d1ee1010e2a5fc7ef61d62b518b7e /lib/random.c
parent633d7b903cf4f428c7a89cac49c3008c78fa01f5 (diff)
random: Fix random number generator.
As written, this "32-bit" random number generator nevers returns a value bigger than 0xfffe0. This fixes the problem.
Diffstat (limited to 'lib/random.c')
-rw-r--r--lib/random.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/random.c b/lib/random.c
index 88ddb4a5..7f892514 100644
--- a/lib/random.c
+++ b/lib/random.c
@@ -103,7 +103,7 @@ static uint32_t
random_next(void)
{
seed ^= seed << 13;
- seed >>= 17;
+ seed ^= seed >> 17;
seed ^= seed << 5;
return seed;