* [PATCH] improve randomness in rand64()
@ 2013-07-19 21:39 Andy Honig
2013-07-20 0:30 ` Dave Jones
0 siblings, 1 reply; 2+ messages in thread
From: Andy Honig @ 2013-07-19 21:39 UTC (permalink / raw)
To: davej; +Cc: trinity
Commit 6112813df53ce6762f5c8de1d4382d67f9f2f769 introduced
code to occasionally invert the valuerand64(). However the code
mistakenly zeroed the value instead by xoring it with itself.
Signed-off-by: Andy Honig <ahonig@google.com>
---
random.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/random.c b/random.c
index a12ba42..b148714 100644
--- a/random.c
+++ b/random.c
@@ -214,7 +214,7 @@ u64 rand64(void)
}
if (rand_bool())
- r ^= r;
+ r = ~r;
/* increase distribution in MSB */
if ((rand() % 10)) {
--
1.8.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-07-20 0:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-19 21:39 [PATCH] improve randomness in rand64() Andy Honig
2013-07-20 0:30 ` Dave Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox