projects
/
openvswitch
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
633d7b9
)
random: Fix random number generator.
author
Ben Pfaff
<blp@nicira.com>
Sat, 13 Nov 2010 01:02:17 +0000
(17:02 -0800)
committer
Ben Pfaff
<blp@nicira.com>
Mon, 15 Nov 2010 17:32:58 +0000
(09:32 -0800)
As written, this "32-bit" random number generator nevers returns a value
bigger than 0xfffe0. This fixes the problem.
lib/random.c
patch
|
blob
|
history
diff --git
a/lib/random.c
b/lib/random.c
index 88ddb4a57824e9d7440a6b90b4fd76338d50362b..7f892514ce09534842984cf8856698be06d7162c 100644
(file)
--- 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;