1 --!!! a random test from Nick North
2 -- (got this in mid-1993; don't remember why. WDP 95/02)
4 random_numbers :: (Int, Int, Int) -> [Float]
5 random_numbers (s1,s2,s3)
6 = map (snd . properFraction . combine) (iterate f (s1,s2,s3))
8 combine :: (Int,Int,Int) -> Float
10 fromIntegral(a)/30269 + fromIntegral(b)/30307
11 + fromIntegral(c)/30323
13 ((171*a) `mod` 30269, (172*b) `mod` 30307, (170*c) `mod` 30323)
15 -- partain: changed to cvt spaces into newlines (easier to see bugs)
17 main = putStr (map cvt (shows (take 1000 (random_numbers (9807, 65, 32975))) "\n"))