Test.QuickCheck.Gen
- Package
- purescript-quickcheck
- Repository
- purescript/purescript-quickcheck
This module defines the random generator monad used by the Test.QuickCheck
module, as well as helper functions for constructing random generators.
#repeatable Source
repeatable :: forall a b. (a -> Gen b) -> Gen (a -> b)
Create a random generator for a function type.
#oneOf Source
oneOf :: forall a. NonEmptyArray (Gen a) -> Gen a
Create a random generator which selects and executes a random generator from a non-empty array of random generators with uniform probability.
#arrayOf1 Source
arrayOf1 :: forall a. Gen a -> Gen (NonEmptyArray a)
Create a random generator which generates a non-empty array of random values.
#enum Source
enum :: forall a. BoundedEnum a => Gen a
Create a random generator for a finite enumeration.
toEnum i
must be well-behaved:
It must return a value wrapped in Just for all Ints between
fromEnum bottom
and fromEnum top
.
#elements Source
elements :: forall a. NonEmptyArray a -> Gen a
Create a random generator which selects a value from a non-empty array with uniform probability.
#perturbGen Source
perturbGen :: forall a. Number -> Gen a -> Gen a
Perturb a random generator by modifying the current seed
#randomSample Source
randomSample :: forall a. Gen a -> Effect (Array a)
Get a random sample of 10 values. For a single value, use randomSampleOne
.
#randomSample' Source
randomSample' :: forall a. Size -> Gen a -> Effect (Array a)
Sample a random generator, using a randomly generated seed
#randomSampleOne Source
randomSampleOne :: forall a. Gen a -> Effect a
Generate a single value using a randomly generated seed.