this function is used in randrun, which is used in shuffle, so we get (for query arc starting at 0)
ghci> shuffle 4 $ run 4
(0>¼)|0
(¼>½)|1
(½>¾)|2
(¾>1)|3
the reason is that the implementation iterates xorwise which maps 0 to 0 (as all xor/shift generators do).
perhaps xorwise can be replaced with something from System.Random. E.g., think of mkStdGen as timeToIntSeed, then the first value already is "random" (non-zero).
this function is used in
randrun
, which is used inshuffle
, so we get (for query arc starting at 0)the reason is that the implementation iterates
xorwise
which maps 0 to 0 (as all xor/shift generators do).perhaps
xorwise
can be replaced with something from System.Random. E.g., think ofmkStdGen
astimeToIntSeed
, then the first value already is "random" (non-zero).