34 static unsigned long next = 1;
37 #ifdef USE_WEAK_SEEDING 43 return ((*ctx = *ctx * 1103515245 + 12345) % ((
unsigned long)
RAND_MAX + 1));
62 x = 16807 * lo - 2836 * hi;
67 return (
int)((*ctx = (
unsigned long)x) % ((
unsigned long)
RAND_MAX + 1));
73 unsigned long val = (
unsigned long)*ctx;
76 *ctx = (
unsigned int)val;
int rand_r(unsigned int *ctx)
static int do_rand(unsigned long *ctx)
int rand(void)
Returns a pseudo-random integer value between 0 and.
static unsigned long next
void srand(unsigned seed)
Seeds the pseudo-random number generator used by.