2017-12-17 13:43:41 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <stdbool.h>
|
2017-12-19 21:00:02 +01:00
|
|
|
#include "random.h"
|
2017-12-17 13:43:41 +01:00
|
|
|
|
|
|
|
unsigned int
|
|
|
|
get_random(unsigned int max)
|
|
|
|
{
|
2017-12-18 09:11:00 +01:00
|
|
|
static bool seeded = false;
|
|
|
|
if (!seeded) {
|
|
|
|
srand(time(NULL));
|
|
|
|
seeded = true;
|
|
|
|
}
|
|
|
|
|
2017-12-17 13:43:41 +01:00
|
|
|
return rand() % (max + 1);
|
|
|
|
}
|