From 75d1f5053c3460484973d6de1d0d7ec9d9a6516d Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Mon, 26 May 2008 14:02:32 +0000 Subject: Fixing random() to work with longs. --- cores/arduino/WMath.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cores/arduino/WMath.cpp') 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) -- cgit v1.2.3-18-g5258