lux/random

Pseudo-random number generation (PRNG) algorithms.

Types

PRNG

An abstract way to represent any PRNG.

(type: #rec PRNG
  (-> lux;Unit [PRNG lux;Nat]))

Random

A producer of random values based on a PRNG.

(type: (Random a)
  (-> PRNG [PRNG a]))

Structs

Applicative<Random>

(lux/control/applicative;Applicative Random)

Functor<Random>

(lux/control/functor;Functor Random)

Monad<Random>

(lux/control/monad;Monad Random)

Values

(alt left right)

Heterogeneous alternative combinator.

(All [a b] (-> (Random a) (Random b) (Random (| a b))))

(array size value-gen)

(All [a] (-> lux;Nat (Random a) (Random (lux/data/struct/array;Array a))))

bool

(Random lux;Bool)

char

(Random lux;Char)

complex

(Random lux/math/complex;Complex)

(dict Hash<a> size key-gen value-gen)

(All [a b] (-> (lux/control/hash;Hash a) lux;Nat (Random a) (Random b) (Random (lux/data/struct/dict;Dict a b))))

(either left right)

Homogeneous alternative combinator.

(All [a] (-> (Random a) (Random a) (Random a)))

(filter pred gen)

Retries the generator until the output satisfies a predicate.

(All [a] (-> (-> a lux;Bool) (Random a) (Random a)))

frac

(Random lux;Frac)

int

(Random lux;Int)

(list size value-gen)

(All [a] (-> lux;Nat (Random a) (Random (lux;List a))))

(maybe value-gen)

(All [a] (-> (Random a) (Random (lux;Maybe a))))

nat

(Random lux;Nat)

(pcg-32 [inc seed])

An implementation of the PCG32 algorithm.

For more information, please see: http://www.pcg-random.org/

(-> [lux;Nat lux;Nat] PRNG)

(queue size value-gen)

(All [a] (-> lux;Nat (Random a) (Random (lux/data/struct/queue;Queue a))))

ratio

(Random lux/math/ratio;Ratio)

real

(Random lux;Real)

(rec gen)

A combinator for producing recursive random generators.

(All [a] (-> (-> (Random a) (Random a)) (Random a)))

(run prng calc)

(All [a] (-> PRNG (Random a) [PRNG a]))

(seq left right)

Sequencing combinator.

(All [a b] (-> (Random a) (Random b) (Random [a b])))

(set Hash<a> size value-gen)

(All [a] (-> (lux/control/hash;Hash a) lux;Nat (Random a) (Random (lux/data/struct/set;Set a))))

(shuffle seed vector)

Shuffle a vector randomly based on a seed value.

(All [a] (-> lux;Nat (lux/data/struct/vector;Vector a) (lux/data/struct/vector;Vector a)))

(stack size value-gen)

(All [a] (-> lux;Nat (Random a) (Random (lux/data/struct/stack;Stack a))))

(text size)

(-> lux;Nat (Random lux;Text))

(text' char-gen size)

(-> (Random lux;Char) lux;Nat (Random lux;Text))

(vector size value-gen)

(All [a] (-> lux;Nat (Random a) (Random (lux/data/struct/vector;Vector a))))

(xoroshiro-128+ [s0 s1])

An implementation of the Xoroshiro128+ algorithm.

For more information, please see: http://xoroshiro.di.unimi.it/

(-> [lux;Nat lux;Nat] PRNG)