summaryrefslogtreecommitdiffstats
path: root/rand.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-10-07 01:21:08 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-10-07 01:21:08 -0700
commit21e158606061246c7fcabb07b18bc5bc2f001054 (patch)
tree3aa07550d6be2de9d258e8079303db734894eafa /rand.h
parentacf39f8972db8171e4be60fc569f325fce64458f (diff)
downloadtxr-21e158606061246c7fcabb07b18bc5bc2f001054.tar.gz
txr-21e158606061246c7fcabb07b18bc5bc2f001054.tar.bz2
txr-21e158606061246c7fcabb07b18bc5bc2f001054.zip
random: bugfix: incorrect WELL512a.
* rand.c (rand32_bug): New static function formed by renaming the original buggy rand32. (rand32_good): Copy of rand32 with two bugfixes. The term involving variable r2 must be only left shifted by 28 bits, and not xor-ed with the original value. The order of operations is wrong in the term that contains the & operation. (rand32): New static function pointer variable, serving as the rand32 function. Points to rand32_good by default. (rand_compat_fixup): Test for 243 or lower compatibility, under which rand32 is made point to rand32_bug. This is done before the call to make_random_state for replacing *random-state*, which has to use the old function. * txr.1: compat note added. * tests/013/maze.expected: Updated.
Diffstat (limited to 'rand.h')
0 files changed, 0 insertions, 0 deletions