* Increase random cycle at marginal cost and make lower order bits
more random.
This commit is contained in:
parent
f4a9e896fd
commit
709a5846a8
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* 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 <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -59,7 +59,7 @@ int
|
|||||||
rand()
|
rand()
|
||||||
{
|
{
|
||||||
rand_state = (16807*rand_state) % 2147483647ul;
|
rand_state = (16807*rand_state) % 2147483647ul;
|
||||||
return rand_state & RAND_MAX;
|
return (rand_state ^ (rand_state >> 16)) & RAND_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user