Tidal
Tidal copied to clipboard
timeToRands produces constant sequence if seed is 0 => replace tidal's random mechanism with System.Random?
ghci> import Sound.Tidal.UI
ghci> timeToRands 0 10
[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
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).
ghci> import System.Random
ghci> uniformR (0,10) (mkStdGen 0)
(8,StdGen {unStdGen = SMGen 16294208416658607535 16294208416658607535})