aboutsummaryrefslogtreecommitdiffstats
path: root/src/Test/VeriFuzz/Graph/Random.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Test/VeriFuzz/Graph/Random.hs')
-rw-r--r--src/Test/VeriFuzz/Graph/Random.hs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Test/VeriFuzz/Graph/Random.hs b/src/Test/VeriFuzz/Graph/Random.hs
index 9aa849b..348c5f6 100644
--- a/src/Test/VeriFuzz/Graph/Random.hs
+++ b/src/Test/VeriFuzz/Graph/Random.hs
@@ -14,12 +14,17 @@ arbitraryEdge n = do
with = suchThat . resize n $ arbitrary
randomDAG :: (Arbitrary l, Arbitrary e, Graph gr)
- => Int -- ^ The number of nodes
- -> IO (gr l e) -- ^ The generated graph. It uses Arbitrary to
- -- generate random instances of each node
+ => Int -- ^ The number of nodes
+ -> Gen (gr l e) -- ^ The generated graph. It uses Arbitrary to
+ -- generate random instances of each node
randomDAG n = do
- list <- generate . infiniteListOf $ arbitrary
- l <- generate . infiniteListOf $ arbitraryEdge n
+ list <- infiniteListOf $ arbitrary
+ l <- infiniteListOf $ arbitraryEdge n
return . mkGraph (nodes list) $ take (10*n) l
where
nodes l = zip [0..n] $ take n l
+
+genRandomDAG :: (Arbitrary l, Arbitrary e, Graph gr)
+ => Int
+ -> IO (gr l e)
+genRandomDAG = generate . randomDAG