diff --git a/cores/arduino/zephyrCommon.cpp b/cores/arduino/zephyrCommon.cpp index 219d3cda..96460470 100644 --- a/cores/arduino/zephyrCommon.cpp +++ b/cores/arduino/zephyrCommon.cpp @@ -328,3 +328,23 @@ void detachInterrupt(pin_size_t pinNumber) { setInterruptHandler(pinNumber, nullptr); } + +#ifndef CONFIG_RNG_GENERATOR_CHOICE + +#include + +void randomSeed(unsigned long) {} + +long random(long min, long max) { + long temp; + + sys_rand_get(&temp, sizeof(temp)); + + return temp % (max - min) + min; +} + +long random(long max) { + return random(0, max); +} + +#endif