Subtractive generator: Difference between revisions

m
→‎{{header|Haskell}}: Applied hindent, added type signatures
m (→‎{{header|Haskell}}: Applied hindent, added type signatures)
Line 854:
 
=={{header|Haskell}}==
<lang haskell>subtractgen seed:: =Int drop-> 220 out where[Int]
subtractgen seed = drop 220 out
out = mmod $ r ++ zipWith (-) out (drop 31 out) where
where
r = take 55 $ shuffle $ cycle $ take 55 s
shuffle x out = headmmod xx:shuffle$ xxr where++ xxzipWith =(-) out (drop 3431 xout)
where
s = mmod $ seed:1:zipWith (-) s (tail s)
r = take 55 $ shuffle $ cycle $ take 55 s
mmod = map (`mod` 10^9)
shuffle x = head xx : shuffle xx
where
xx = drop 34 x
out s = mmod $ rseed ++: 1 : zipWith (-) outs (droptail 31 outs) where
mmod = map (`mod` 10 ^ 9)
 
main :: IO ()
main = mapM_ print $ take 10 $ subtractgen 292929</lang>
{{out}}
9,659

edits