Files
musl/src/prng/rand.c

16 lines
183 B
C
Raw Normal View History

2011-02-12 00:22:29 -05:00
#include <stdlib.h>
#include <stdint.h>
2011-02-12 00:22:29 -05:00
static uint64_t seed;
2011-02-12 00:22:29 -05:00
void srand(unsigned s)
{
seed = s-1;
}
int rand(void)
{
seed = 6364136223846793005ULL*seed + 1;
return seed>>33;
2011-02-12 00:22:29 -05:00
}