https://github.com/leostera/random
Easy-to-use, cryptographically safe random data for OCaml
https://github.com/leostera/random
Last synced: 9 months ago
JSON representation
Easy-to-use, cryptographically safe random data for OCaml
- Host: GitHub
- URL: https://github.com/leostera/random
- Owner: leostera
- License: mit
- Created: 2024-02-17T20:09:27.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-15T21:43:03.000Z (about 2 years ago)
- Last Synced: 2025-02-10T22:51:38.195Z (over 1 year ago)
- Language: OCaml
- Size: 6.84 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# random
Easy to use, cryptographically safe random data generators. Just call `Random.`:
```ocaml
let size = 2112
(* random numbers *)
let random_int8 = Random.int8 ()
let random_int16 = Random.int16 ()
let random_int32 = Random.int32 ()
let random_int64 = Random.int64 ()
let random_int_up_to_2112 = Random.int ~max:2112
let random_float_up_to_69_420 = Random.float ~max:69.420
(* random strings and chars *)
let random_char = Random.char ()
let random_alpha_num = Random.alphanum ()
let random_string = Random.string size
let random_bytes = Random.bytes size
(* sequences *)
let infinite_number_sequence = Random.(seq int)
let infinite_char_sequence = Random.(seq char)
(* lists *)
let list_of_10_ints = Random.(list int 10)
```