Commit 40fc171e authored by sof's avatar sof
Browse files

[project @ 1999-05-13 11:03:10 by sof]

Testing the Random library (not complete).
parent dc83b06b
module Main(main) where
import Random
tstRnd rng = checkRange rng (genRnd 50 rng)
genRnd n rng = take n (randomRs rng (mkStdGen 2))
checkRange (lo,hi) = all pred
where
pred
| lo <= hi = \ x -> x >= lo && x <= hi
| otherwise = \ x -> x >= hi && x <= lo
main :: IO ()
main = do
print (tstRnd (1,5::Double))
print (tstRnd (1,5::Int))
print (tstRnd (10,54::Integer))
print (tstRnd ((-6),2::Int))
print (tstRnd (2,(-6)::Int))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment