From: Ben Pfaff Date: Sat, 13 Nov 2010 01:02:17 +0000 (-0800) Subject: random: Fix random number generator. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7918636f05b058cf621cca1e6772e427b5eb736e;p=openvswitch random: Fix random number generator. As written, this "32-bit" random number generator nevers returns a value bigger than 0xfffe0. This fixes the problem. --- 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;