random0.ml 648 B

1234567891011121314151617181920
  1. (* https://raw.githubusercontent.com/aantron/dream/8612f6a661053ba4e0800c9c6c7f39bdefd5f9eb/src/cipher/random.ml *)
  2. (* This file is part of Dream, released under the MIT license. See LICENSE.md
  3. for details, or visit https://github.com/aantron/dream.
  4. Copyright 2021 Anton Bachin *)
  5. (* TODO LATER Is there something with lighter dependencies? Although perhaps
  6. these are not so bad... *)
  7. (* API change in mirage-crypto-rng 1.0
  8. FreeBSD ocaml-lsp-server https://github.com/ocaml/ocaml-lsp/issues/1069#issuecomment-2376511874
  9. *)
  10. let random_buffer = Mirage_crypto_rng.generate
  11. let random n =
  12. n
  13. |> random_buffer
  14. |> Cstruct.to_string