package base

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

Source file random_repr.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

module Repr = struct
  open Caml.Bigarray

  type t = (int64, int64_elt, c_layout) Array1.t

  let of_state : Caml.Random.State.t -> t = Caml.Obj.magic
end

let assign dst src =
  let dst = Repr.of_state (Lazy.force dst) in
  let src = Repr.of_state (Lazy.force src) in
  Caml.Bigarray.Array1.blit src dst

let make_default default =
  let split_from_parent v =
    Caml.Lazy.map_val Caml.Random.State.split v
  in
  Caml.Domain.DLS.new_key ~split_from_parent (fun () -> default)

let get_state random_key = Caml.Domain.DLS.get random_key
OCaml

Innovation. Community. Security.