-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Closed
Labels
Component: CoreRelated to the code for the standard Arduino APIRelated to the code for the standard Arduino API
Milestone
Description
This is Issue 575 moved from a Google Code project.
Added by 2011-08-05T07:31:16.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.
Original labels: Type-Defect, Priority-Medium
Original description
OBSERVATION
Wmath.cpp
/ Wprogram.h
have defined randomSeed
as
void randomSeed(unsigned int seed)
{
if (seed != 0) {
srandom(seed);
}
}
while the avrlib defines - void srandom (unsigned long __seed);
This means loss of 2^32 -2^16 possible seeds to randomize.
PROPOSAL
If you accept 0 as a valid seed you can rewrite it to:
# define randomSeed(s) srandom(s)
otherwise
void randomSeed(unsigned long seed)
{
if (seed != 0) srandom(seed);
}
See - https://forum.arduino.cc/t/the-reliable-but-not-very-sexy-way-to-seed-random/65872/38
// using windows 7/64 IDE 22
Metadata
Metadata
Assignees
Labels
Component: CoreRelated to the code for the standard Arduino APIRelated to the code for the standard Arduino API