We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 389b9b8 commit b83289bCopy full SHA for b83289b
core-implement/CommonMath.cpp
@@ -0,0 +1,27 @@
1
+/*
2
+// This file is subject to the terms and conditions defined in
3
+// file 'LICENSE.md', which is part of this source code package.
4
+*/
5
+
6
+#include "mbed.h"
7
8
+#define PinMode Arduino_PinMode
9
+#include "core-api/api/Common.h"
10
+#undef PinMode
11
12
+// WMath prototypes
13
+long random(long upper){
14
+ if(upper == 0){ return 0; }
15
+ return random(0, upper);
16
+}
17
18
+long random(long lower, long upper){
19
+ long diff = upper - lower;
20
+ return rand() % diff + lower;
21
22
23
+void randomSeed(unsigned long seed){
24
+ if ( seed != 0 ){
25
+ srand( seed ) ;
26
+ }
27
0 commit comments