Module ce_random

Description

Pseudo-random numbers library.

Function Index

Exported Functions
d/2Simulates rolling N dice of M faces each.
dist/1Picks a random element M from a list of pairs {N, M} where N is the percentage chance of M being returned.
pick/1Picks a random element from a tuple or a list (equal chance for every element.).
scramble/1Randomizes the order of a tuple or list.
seed/0Seeds the random number generator so that it will produce unpredictable values.

Exported Functions

d/2

d(NumberOfDice::integer(), FacesPerDie::integer()) -> integer()

Simulates rolling N dice of M faces each.

dist/1

dist(distribution()) -> term()

Picks a random element M from a list of pairs {N, M} where N is the percentage chance of M being returned.

pick/1

pick(tuple() | [term()]) -> term()

Picks a random element from a tuple or a list (equal chance for every element.)

scramble/1

scramble(tuple() | [term()]) -> tuple() | [term()]

Randomizes the order of a tuple or list.

seed/0

seed() -> ok

Seeds the random number generator so that it will produce unpredictable values. Should be called once at the startup of the process, before using random numbers.