HydroRandom

This module contains functions for the creation of random numbers and handling of the random number generator.

Example:

(HydroRandom.uniform 10)

buf

defn

(Fn [Int] (Array Byte))

                    (buf n)
                

creates a buffer containing random numbers.

buf-deterministic

defn

(Fn [Int, (Ref (Array Byte) a)] (Array Byte))

                    (buf-deterministic len seed)
                

creates a buffer containing len numbers indistinguishable from random bytes without knowing seed. For a given seed, this function will always output the same sequence. This function is mainly useful for writing tests.

ratchet

external

(Fn [] ())

erases part of the RNG state to make recovering previous RNG states impossible.

reseed

external

(Fn [] ())

reseeds the RNG; this is important to do after starting new threads.

seed-bytes

external

Int

The number of bytes a seed takes up.

u32

external

(Fn [] Int)

creates an unsigned random number of 32 bit length.

uniform

external

(Fn [Int] Int)

creates a uniform random number from 0 to an upper limit provided as argument.