From 709a5846a848c9a4411bca77403333a203ab7e22 Mon Sep 17 00:00:00 2001 From: bg- Date: Fri, 1 Jun 2007 15:28:02 +0000 Subject: [PATCH] * Increase random cycle at marginal cost and make lower order bits more random. --- core/lib/rand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/lib/rand.c b/core/lib/rand.c index 5088055df..2a1869328 100644 --- a/core/lib/rand.c +++ b/core/lib/rand.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: rand.c,v 1.3 2007/04/24 19:01:39 bg- Exp $ + * @(#)$Id: rand.c,v 1.4 2007/06/01 15:28:02 bg- Exp $ */ #include @@ -59,7 +59,7 @@ int rand() { rand_state = (16807*rand_state) % 2147483647ul; - return rand_state & RAND_MAX; + return (rand_state ^ (rand_state >> 16)) & RAND_MAX; } void