blob: 3567ae0dd8e7220c92a2e0e8aeb197d29123d9ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
module Main(main) where
import System.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))
|