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.

14 lines
390 B

  1. #include "utils.h"
  2. #include "helper.h"
  3. int randomIntRange(int min, int max)
  4. {
  5. int value = randomInt();
  6. return (value % (max - min + 1)) + min;
  7. }
  8. int map(int x, int in_min, int in_max, int out_min, int out_max)
  9. {
  10. //vgl Arduino map() https://www.arduino.cc/reference/en/language/functions/math/map/
  11. return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
  12. }