fxlibc/3rdparty/tinymt32/rand.c
2023-04-01 20:30:30 +02:00

20 lines
284 B
C

#include <stdlib.h>
#include "tinymt32.h"
static tinymt32_t random;
void srand(unsigned int seed)
{
tinymt32_init(&random, seed);
}
int rand(void)
{
return tinymt32_generate_uint32(&random) & 0x7fffffff;
}
__attribute__((constructor))
static void init_prng(void)
{
srand(1);
}