Module Random.Gen

Custom random function metadata key.

If a gist or field metadata defines a value for this key, the Fun.Generic.random function uses it for random generation.

Using a function that always returns the same value like Gen.const does can be used to have a substructure remaining constant.

type 'a t = size:int -> Stdlib.Random.State.t -> bound:int -> 'a

The type for custom random generators.

bound is a bounding factor that initally depends on size for recursive data structures. When the bound reaches 0 you should no longer recurse.

val const : 'a -> 'a t

const v leaves the random state untouched and always returns v.

val mem : ('a, 'b) Type.Gist.Meta.t2 -> bool
val add : 'b t -> ('a, 'b) Type.Gist.Meta.t2 -> ('a, 'b) Type.Gist.Meta.t2
val find : ('a, 'b) Type.Gist.Meta.t2 -> 'b t option
val remove : ('a, 'b) Type.Gist.Meta.t2 -> ('a, 'b) Type.Gist.Meta.t2