EasyRandom

EasyRandom library

Simple usage:

import EasyRandom "mo:easy-random/EasyRandom";


let entropy = await Random.blob(); 
let finite = Random.Finite(entropy);
let randomFromZeroToNine : ?Nat = EasyRandom.nextNat(finite, 10);

public func nextNat(finite : Random.Finite, max : Nat) : ?Nat

Generate a random number between 0 and [max] - 1, using the provided [finite].

As other Random methods, null is returned if [finite] doesn't contain enought entropy.