µTasker Forum
µTasker Forum => µTasker general => Topic started by: dkg on September 29, 2009, 08:26:55 PM
-
Hi Mark,
I saw back in April someone found that fnRandom() was not changing. You found a bug in the function and found a replacement algorithm (see: http://www.utasker.com/forum/index.php?topic=582.0).
In my copy of v1.4 there is a line missing in fnRandom which is critical to successfully generating random numbers. After calculating the new value in ulShifter, we need a line to store it back into ulRandomNumber:
usRandomNumber = usShifter;
Otherwise ulShifter will be calculated to be the same everytime the function is called.
Dave G.
-
Hi Dave
Thanks for pointing this out since this line has indeed disappeared in the V1.4 version. It is strange since it is correct in the thread...
I will put a link to this in all of the patch threads and have corrected it in the master version so that it is there in future updates.
Thanks again.
Regards
Mark
P.S. Note that in V1.4 the random number also continues to increment between resets of the board so that sequences don't repeat an each warm start. This will have taken place without the correction above but repeated calls in between were faulty.