For a given list [1..n], where n is a random positive integer, I want to generate the test data with 2 steps:
- Shuffle the list, xs = shuffle [1..n];
- Random mutate a number x in xs to y, where 1 <= y <= n;
After these 2 steps, the new list is denoted as ys.
I wrote a program. It takes ys, and outputs (x, y), the function prototype is like this:
solve :: [a] -> (a, a)
I want to use Test.QuickCheck to test my program. How to generate such test data? I see there is a function in QuickCheck
shuffle :: [a] -> Gen [a]
But I have no idea about how to use it.