15 line
No EOL
351 B
C
15 line
No EOL
351 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <time.h>
|
|
#include "randomness.h"
|
|
|
|
void init_randomness(void) //to be called only one time in main function
|
|
{
|
|
srand(time(NULL));
|
|
}
|
|
|
|
float random_float(float min, float max)
|
|
{
|
|
//generate a random float number in [min ; max] inclusive
|
|
return min + ((float)rand()/(float)RAND_MAX) * (max-min);
|
|
} |