package dream

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

Source file random.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(* This file is part of Dream, released under the MIT license. See LICENSE.md
   for details, or visit https://github.com/aantron/dream.

   Copyright 2021 Anton Bachin *)



(* TODO LATER Is there something with lighter dependencies? Although perhaps
   these are not so bad... *)

let initialize =
  lazy (Mirage_crypto_rng_lwt.initialize ())

let random_buffer n =
  Lazy.force initialize;
  Mirage_crypto_rng.generate n

let random n =
  Cstruct.to_string (random_buffer n)
OCaml

Innovation. Community. Security.