module Z:S.N
with type t = Z.t
type
t
val gen : ?g:Nocrypto.Rng.g -> t -> t
gen ~g n
picks a value in the interval [0, n - 1]
uniformly at random.val gen_r : ?g:Nocrypto.Rng.g ->
t -> t -> t
gen_r ~g low high
picks a value from the interval [low, high - 1]
uniformly at random.val gen_bits : ?g:Nocrypto.Rng.g -> ?msb:int -> int -> t
gen_bits ~g ~msb n
picks a bit-string n
bits long, with msb
most
significant bits set, and interprets it as a t in big-endidan.
This yields a value in the interval
[2^(n-1) + ... + 2^(n-msb), 2^n - 1]
.
msb
defaults to 0
which reduces gen_bits k
to gen 2^k
.