Author Topic: fnRandom() not changing in v1.4  (Read 11243 times)

Offline dkg

  • Newbie
  • *
  • Posts: 48
    • View Profile
fnRandom() not changing in v1.4
« 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:

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:

Code: [Select]
usRandomNumber = usShifter;
Otherwise ulShifter will be calculated to be the same everytime the function is called.

Dave G.

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3238
    • View Profile
    • uTasker
Re: fnRandom() not changing in v1.4
« Reply #1 on: September 29, 2009, 09:05:19 PM »
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.



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.