mirror of
https://github.com/fluencelabs/musl
synced 2025-07-01 15:42:05 +00:00
initial check-in, version 0.5.0
This commit is contained in:
13
src/prng/rand.c
Normal file
13
src/prng/rand.c
Normal file
@ -0,0 +1,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;
|
||||
}
|
Reference in New Issue
Block a user