From: Tyson Smith <tyson.w.sm...@gmail.com>

---
 random.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/random.c b/random.c
index 7917f78..8b4f715 100644
--- a/random.c
+++ b/random.c
@@ -171,15 +171,9 @@ u64 rand64(void)
        if (ONE_IN(25))
                r = ~r;
 
-       /* increase distribution in MSB */
-       if (ONE_IN(10)) {
-               unsigned int i;
-               unsigned int rounds;
-
-               rounds = rand() % 4;
-               for (i = 0; i < rounds; i++)
-                       r |= (1UL << ((__WORDSIZE - 1) - (rand() % 8)));
-       }
+       /* Set ~2 bits in MSB to increase distribution */
+       if (ONE_IN(10))
+               r |= (rand() & rand() & 0xffULL) << 56;
 
        /* Sometimes flip sign */
        if (ONE_IN(25))
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe trinity" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to