This package uses nocrypto's fortuna RNG for the random part of the ULID, but a different generator can be passed in with the signature int -> int (to generate a random number between 0 and n-1).
Help is welcome!
Installation
ulid can be installed with opam:
opam install ulid
Usage
basic ulid generation:
let ulid = Ulid.ulid ();; (* something like 01D07HWDR77VCQ6CC8XSDC916T *)
passing in a seed time instead of current time (see spec for more details):
let ulid = Ulid.ulid ?seed_time:123 ();;
getting monotonic ulids:
let get_ulid = Ulid.monotonic_factory ();;
let ulid = get_ulid ();;
using a different PRNG:
let get_ulid = Ulid.ulid_factory ~prng:my_favorite_prng ();;
let ulid = get_ulid ();;