
7 Oct
2015
7 Oct
'15
7:16 p.m.
You can generate two unequal integers by doing prop_twoDifferent :: Int -> Int -> Bool prop_twoDifferent x y = yourFn2 x y' where y' = if y >= x then y+1 else y Letting the number of distinct Int values be N, there are N*N pairs of Ints but only N*(N-1) pairs of *different* Ints, so this technique will generate some x y' pairs more often than others. In fact you will get (x,minBound::Int) with probability 2/N and (x,y>minBound) with probability 1/N. The advantage of using a guard is that the probabilities come out right (it's the "rejection method", in statistical parlance). You can use that method to generate x x y x y x y x x You can iterate the same idea to generate triples.