2021-05-25 02:16:29 +02:00
|
|
|
#include <stdint.h>
|
2022-04-15 11:00:55 +02:00
|
|
|
#include <stdlib.h>
|
2021-05-25 02:16:29 +02:00
|
|
|
|
|
|
|
static uint64_t seed;
|
|
|
|
|
|
|
|
void srand(unsigned s)
|
|
|
|
{
|
2022-04-15 11:00:55 +02:00
|
|
|
seed = s - 1;
|
2021-05-25 02:16:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int rand(void)
|
|
|
|
{
|
2022-04-15 11:00:55 +02:00
|
|
|
seed = 6364136223846793005ULL * seed + 1;
|
|
|
|
return seed >> 33;
|
2021-05-25 02:16:29 +02:00
|
|
|
}
|