diff options
author | David A. Mellis <d.mellis@arduino.cc> | 2008-05-26 14:02:32 +0000 |
---|---|---|
committer | David A. Mellis <d.mellis@arduino.cc> | 2008-05-26 14:02:32 +0000 |
commit | 75d1f5053c3460484973d6de1d0d7ec9d9a6516d (patch) | |
tree | b92eef516954d9f04f3ffbf5f0451f70b68ce317 /cores/arduino/WMath.cpp | |
parent | 03d7c9b846e0c915fce8ee171d2000dd80c9d258 (diff) |
Fixing random() to work with longs.
Diffstat (limited to 'cores/arduino/WMath.cpp')
-rw-r--r-- | cores/arduino/WMath.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cores/arduino/WMath.cpp b/cores/arduino/WMath.cpp index c1471ca..78667f3 100644 --- a/cores/arduino/WMath.cpp +++ b/cores/arduino/WMath.cpp @@ -40,7 +40,7 @@ long random(long howbig) if (howbig == 0){ return 0; } - return rand() % howbig; + return (rand() * 0x10000L + rand()) % howbig; } long random(long howsmall, long howbig) |