We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b06ce03 commit a85ee7eCopy full SHA for a85ee7e
1 file changed
ArduinoCore-Linux/cores/arduino/WMath.cpp
@@ -0,0 +1,26 @@
1
+// WMath.cpp
2
+#include "Common.h"
3
+extern "C" {
4
+ #include <stdlib.h>
5
+}
6
+
7
+long random(long howbig) {
8
+ if (howbig == 0) {
9
+ return 0;
10
+ }
11
+ return (long)(rand() % howbig);
12
13
14
+long random(long howsmall, long howbig) {
15
+ if (howsmall >= howbig) {
16
+ return howsmall;
17
18
+ long diff = howbig - howsmall;
19
+ return random(diff) + howsmall;
20
21
22
+void randomSeed(unsigned long seed) {
23
+ if (seed != 0) {
24
+ srand(seed);
25
26
0 commit comments