X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Flib.c;h=c1063516f3256e1714cac58e58a606712b29302d;hb=652ddd443bc0b8cdde1295c7497854b4e4c854d5;hp=88dc90c46737056c236f8624d5865c922638af1d;hpb=e4b700d576ea9155c3fc86b0c57869a224851954;p=tpg%2Facess2.git diff --git a/Kernel/lib.c b/Kernel/lib.c index 88dc90c4..c1063516 100644 --- a/Kernel/lib.c +++ b/Kernel/lib.c @@ -319,21 +319,12 @@ Sint64 timestamp(int sec, int mins, int hrs, int day, int month, int year) */ Uint rand() { - #if 0 - Uint ret = giRandomState; - int roll = randomState & 31; - randomState = (randomState << roll) | (randomState >> (32-roll)); - randomState ^= 0x9A3C5E78; - return ret; - #else Uint old = giRandomState; + // Get the next state value giRandomState = (RANDOM_A*giRandomState + RANDOM_C) & 0xFFFFFFFF; - if(giRandomState == old) { - giRandomState += RANDOM_SPRUCE; - } - Log("giRandomState = 0x%x", giRandomState); + // Check if it has changed, and if it hasn't, change it + if(giRandomState == old) giRandomState += RANDOM_SPRUCE; return giRandomState; - #endif } EXPORT(timestamp);