Subtractive generator: Difference between revisions

m
→‎{{header|Haskell}}: An applicative simplification of the shuffle function
m (→‎{{header|Phix}}: syntax coloured)
m (→‎{{header|Haskell}}: An applicative simplification of the shuffle function)
Line 897:
subtractgen seed = drop 220 out
where
out = mmod $ r ++<> zipWith (-) out (drop 31 out)
where
r = take 55 $ shuffle $ cycle $ take 55 s
shuffle x = head((:) xx. :head <*> shuffle) (drop 34 xxx)
where
xx = drop 34 x
s = mmod $ seed : 1 : zipWith (-) s (tail s)
mmod = mapfmap (`mod` 10 ^ 9)
 
main :: IO ()
9,655

edits