quickcheck can also be used to generate random numbers and actually really good combinators, which make it more understandable to formulate the generator.
To use it, you just need to import one module:
import Test.QuickCheck
The definition of the generator can be performed as follows:
t :: Int -> (Int,Int) -> Gen [Int] tnr = vectorOf n (choose r)
To run this generator, you can use sample' :
randomList nr = head `fmap` (sample' $ tnr)
source share