From 3233d7939bb5bbabc8c60352fe87d647e07be764 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Mon, 26 May 2008 14:02:32 +0000 Subject: [PATCH] Fixing random() to work with longs. --- hardware/cores/arduino/WMath.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/cores/arduino/WMath.cpp b/hardware/cores/arduino/WMath.cpp index c1471ca31..78667f331 100644 --- a/hardware/cores/arduino/WMath.cpp +++ b/hardware/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)