package splittable_random

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Splittable_random.StateSource

Sourcetype t

Create a new t seeded from the given random state. This allows nondeterministic initialization, for example in the case that the input state was created using Random.State.make_self_init.

Constructors like create and of_int should be called once at the start of a randomized computation and the resulting state should be threaded through. Repeatedly creating splittable random states from seeds in the middle of computation can defeat the SPRNG's splittable properties.

Sourceval of_int : Base.int -> t

Create a new t that will return identical results to any other t created with that integer.

Sourceval perturb : t -> Base.int -> Base.unit

perturb t salt adds the entropy of salt to t.

Sourceval copy : t -> t

Create a copy of t that will return the same random samples as t.

Sourceval split : t -> t

split t produces a new state that behaves deterministically (i.e. only depending on the state of t), but pseudo-independently from t. This operation mutates t, i.e., t will return different values than if this hadn't been called.