You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123456789101112131415 |
- #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);
- }
|