diff --git a/cores/arduino/zephyrCommon.cpp b/cores/arduino/zephyrCommon.cpp index 219d3cda..f89f03f9 100644 --- a/cores/arduino/zephyrCommon.cpp +++ b/cores/arduino/zephyrCommon.cpp @@ -328,3 +328,21 @@ void detachInterrupt(pin_size_t pinNumber) { setInterruptHandler(pinNumber, nullptr); } + +#ifndef CONFIG_MINIMAL_LIBC_RAND + +#include + +void randomSeed(unsigned long seed) { + srand(seed); +} + +long random(long min, long max) { + return rand() % (max - min) + min; +} + +long random(long max) { + return rand() % max; +} + +#endif