Context
public class Context
The context will be passed through all generators
It’s main purpose is to hold onto the Random Number Generator rng
, so that as generations occur the RNG’s state changes are propogated to each generator
Note
The context can be held onto by a user to keep track ofrng
‘s state between generations
-
The original seed used to begin random number generation, if available
To be used for debugging purposes and to “replay” a generation event
Declaration
Swift
public let originalSeed: UInt64?
-
The maximum depth that a generator which rejects values can reach before failing
See also
Gen.filter(isIncluded:)
See also
Gen.unique()
Declaration
Swift
public var maxDepth: Int
-
The maximum iterations that producers should run for
See also
Gen.take(count:context:)
See also
Gen.forEach(iterations:context:)
See also
Gen.allSatisfy(iterations:context:)
Declaration
Swift
public var maxIterations: Int
-
Creates a
Context
Declaration
Swift
public init(using rng: RandomNumberGenerator, originalSeed: UInt64? = nil)
Parameters
rng
The Random Number Generator to be used to produce values
originalSeed
The original seed (start position) of
rng
, if possible -
Initializes a
Context
with aDeterminism
Declaration
Swift
convenience init(determinism: Determinism)
-
Creates a
Context
initialized to default values, with randomDeterminism
Declaration
Swift
static var random: Context { get }
-
Creates a default
Context
Declaration
Swift
static var `default`: Context { get }