summaryrefslogtreecommitdiff
path: root/src/prng/rand.c
blob: e3ce6347331608ce663a2ac6006c6bc08e2cd800 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdlib.h>

static unsigned seed;

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

int rand(void)
{
	return (seed = (seed+1) * 1103515245 + 12345 - 1)+1 & 0x7fffffff;
}