Gen Module
Table of contents
Other module members
Functions and values
| Function or value |
Description
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Build a generator that randomly generates one of the values in the given non-empty, finite seq.
|
||
|
Generates a value that satisfies a predicate. Contrary to tryFilter, this function keeps re-trying by increasing the size of the original generator ad infinitum. Make sure there is a high probability that the predicate is satisfied. The `filter` function is an alias for the `where` function. These two functions are identical, but co-exist so that you can choose the word that makes your code most readable in your given context.
|
||
|
|||
|
Build a generator that generates a value from one of the generators in the given non-empty seq, with given probabilities. The sum of the probabilities must be larger than zero.
|
||
|
Generate fresh instances by calling create every time the generator generates a new value. Useful for generating new instances of mutable objects. See also constant.
|
||
|
Build a generator that takes a non-empty sequence and randomly generates one of the values among an initial segment of that sequence. The size of this initial segment increases with the size parameter. Essentially this generator is Gen.elements but taking also the size into account.
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Applies the given chooser function to successive values generated by the given generator, returning the first result where the function returns Some(x). Contrary to tryPick, this function keeps re-trying by increasing the size of the original generator ad infinitum. Make sure there is a high probability that the chooser function returns Some for some values.
|
||
|
Generates random arrays of given length where the sum of all elements equals the given sum.
|
||
|
|||
|
Generates a given number of values with a new seed and a size of 50.
|
||
|
|||
Full Usage:
Gen.sampleWithSize size nbSamples gen
Parameters:
int
nbSamples : int
gen : Gen<'T>
Returns: 'T[]
|
Generates a given number of values with a new seed and a given size.
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Generates sublists of the given seq. For a given list of length n, each sublist has between 0 and n elements, and the order of the elements is the same as in the given seq.
|
||
|
|||
|
Tries to generate a value that satisfies a predicate. This function 'gives up' by generating None if the given original generator did not generate any values that satisfied the predicate, after trying to get values by increasing its size. The `tryFilter` function is an alias for the `tryWhere` function. These two functions are identical, but co-exist so that you can choose the word that makes your code most readable in your given context.
|
||
|
Tries to apply the given chooser function to successive values generated by the given generator, returning the first result where the function returns Some(x). This function 'gives up' by generating None if the given original generator did not generate any values for which the chooser function returned Some(x), after trying to get values by increasing its size.
|
||
|
Tries to generate a value that satisfies a predicate. This function 'gives up' by generating None if the given original generator did not generate any values that satisfied the predicate, after trying to get values by increasing its size. The `tryWhere` function is also aliased as `tryFilter`. These two functions are identical, but co-exist so that you can choose the word that makes your code most readable in your given context.
|
||
|
Generates a value that satisfies a predicate. Contrary to tryWhere, this function keeps re-trying by increasing the size of the original generator ad infinitum. Make sure there is a high probability that the predicate is satisfied. The `where` function is also aliased as `filter`. These two functions are identical, but co-exist so that you can choose the word that makes your code most readable in your given context.
|
||
|
|||
|
Create generators from generators
Functions and values
| Function or value |
Description
|
|
|
|
Traverse the given enumerable into a generator of an enumerable using the specified binder function to create generators. Each seq generated by the resulting generator can be infinite, if the source seq is infinite. [category: Create generators from generators]
|
Creating generators from generators
Functions and values
| Function or value |
Description
|
|
FsCheck