Module Random.Gen

Custom random generator.

The Fun.Generic.random function consults this key in the metadata of a gist g before generating values described by the gist. If a function is found, the values are generated with this function instead.

This can also be used to indicate that you would like a substructure to remain constant. The Gen.const function does that.

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

The type for custom random generators. bound is a bounding factor that depends on size for recursive data structures when the bound reaches 0 you should no longer recurse.

val const : 'a -> 'a t

const v ignores the random generator and returns v.

type 'a meta := 'a Type.Gist.Meta.t
val mem : 'a meta -> bool

mem m is true iff m has a binding for the key.

val add : 'a t -> 'a meta -> 'a meta

add v m is m with the key bound to v

val find : 'a meta -> 'a t option

find m is the binding for the key (if any).

val remove : 'a meta -> 'a meta

remove m is m with the binding for the key removed (if bound).