aboutsummaryrefslogtreecommitdiff
path: root/src/prng/rand.c
blob: 0131ecd644ff4c35ce0f405d057df36fd9ce962f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdlib.h>
#include <stdint.h>

static uint64_t seed;

void srand(unsigned s)
{
	seed = s-1;
}

int rand(void)
{
	seed = 6364136223846793005ULL*seed + 1;
	return seed>>33;
}


#ifdef TEST
int
main(void) {
	return 0;
}
#endif