package stdlib-random

  1. Overview
  2. Docs
Versioned Random module from the OCaml standard library

Install

Dune Dependency

Authors

Maintainers

Sources

stdlib-random-1.1.0.tbz
sha256=8b930182fe680b8b96ad1e082b87a17c8011d95a670f557c703035f04f812559
sha512=c406f3598664593676c0cfcc9f248c0c6114602ab0cd9f2c9ab03243debc534515ab61eb8de8c92bdbbed2a6c916441606263e7e577b1a989da41660315c12dc

Description

The stdlib-random package provides a stable and compiler-independent implementation of all the PRNGs used in the Random module. Those PRNGs are available in the various libraries:

  • stdlib-random.v3: OCaml 3.07 to 3.11 PRNG
  • stdlib-random.v4: OCaml 3.12 to 4.14 PRNG
  • stdlib-random.v5: current OCaml 5.0 PRNG
  • stdlib-random.v5o: pure OCaml version of the OCaml 5 PRNG All those libraries can be used together and the signature of their Random$n module has been extended to the latest signature whenever possible.

Published: 28 Jun 2023

README

Compatibility library for Random number generation

This library provides access to the various implementation of the Random module from the OCaml standard library independently of the compiler version.

Signature compatibility

Whenever possible, the signature of the the older Random module has been extended with functions that were added in newer versions.

Currently, this means that all Random* modules before v5 shares the exact same type whereas the Random5 module is the only to define a split function since previous PRNGs are not splittable.

stdlib-random.v5 library

The stdlib-random.v5 library uses the same LXM pseudo-random number generator as the one used in OCaml 5.

For versions of OCaml that support multiple domains, the global PRNG of this library is a domain local state rather than a global state to avoid any potential contention issue on this global PRNG. Moreover, whenever a new domain is spawn, its global PRNG is split from the PRNG of the parent domain which ensures that both PRNGs are essentially independent.

stdlib-random.v5o library

The stdlib-random.v5o library provides a pure OCaml alternative to the stdlib-random.v5 library which uses a C implementation when updating the PRNG state.

stdlib-random.v4 library

The stdlib-random.v4 library exposes the lagged-Fibonacci F(55, 24, +) PRNG with a modified addition function used from OCaml 3.12 to OCaml 4.14 .

stdlib-random.v3 library

The stdlib-random.v3 library exposes the lagged-Fibonacci F(55, 24, +) PRNG used from OCaml 3.07 to OCaml 3.11.

Note that this library prioritizes compatibility over correctness. In particular, the state of this generator is not marshallable across architecture with different word size. It is thus advisable to use this PRNG only when compatibility with OCaml 3 PRNG is a strict requirement.

Dependencies (3)

  1. ocaml >= "4.08.0"
  2. cppo >= "1.1.0"
  3. dune >= "2.7"

Dev Dependencies (1)

  1. odoc with-doc

Used by (2)

  1. camomile >= "2.0.0"
  2. mutaml

Conflicts

None