1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-03 14:24:15 +01:00

Fixing random() to work with longs.

This commit is contained in:
David A. Mellis 2008-05-26 14:02:32 +00:00
parent 114a19c9a2
commit 3233d7939b

View File

@ -40,7 +40,7 @@ long random(long howbig)
if (howbig == 0){ if (howbig == 0){
return 0; return 0;
} }
return rand() % howbig; return (rand() * 0x10000L + rand()) % howbig;
} }
long random(long howsmall, long howbig) long random(long howsmall, long howbig)