No Description
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.

randomness.c 351B

123456789101112131415
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include "randomness.h"
  5. void init_randomness(void) //to be called only one time in main function
  6. {
  7. srand(time(NULL));
  8. }
  9. float random_float(float min, float max)
  10. {
  11. //generate a random float number in [min ; max] inclusive
  12. return min + ((float)rand()/(float)RAND_MAX) * (max-min);
  13. }