Liking cljdoc? Tell your friends :D

com.yetanalytics.datasim.util.random

Random number generation and probabilistic operations.

Random number generation and probabilistic operations.
raw docstring

chooseclj

(choose rng weights coll)

Probabilistically select one element from coll. The weights map should be a map of coll elements numerical weights. If an element does not have an associated weight, it will be assigned a default of 0.5. Note that a weight of 0 denotes that the element can never be chosen.

Probabilistically select one element from `coll`. The `weights` map
should be a map of `coll` elements numerical weights. If an element does
not have an associated weight, it will be assigned a default of 0.5.
Note that a weight of 0 denotes that the element can never be chosen.
sourceraw docstring

choose-mapclj

(choose-map rng weights m)

Probabilistically select one value from the map m. The weights map should be a map from the keys of m to numerical weights. If an element does not have a weight, it will be assigned a default of 0.5. Note that a weight of 0 denotes that the element can never be chosen.

Probabilistically select one value from the map `m`. The `weights` map
should be a map from the keys of `m` to numerical weights. If an
element does not have a weight, it will be assigned a default of 0.5.
Note that a weight of 0 denotes that the element can never be chosen.
sourceraw docstring

default-weightclj

source

randclj

(rand rng)
(rand rng n)

Generate a pseudorandom, uniformly distributed double value between 0 and n (both inclusive).

See also: clojure.core/rand

Generate a pseudorandom, uniformly distributed double value between 0 and
`n` (both inclusive).

See also: `clojure.core/rand`
sourceraw docstring

rand-booleanclj

(rand-boolean rng prob)

Generate a pseudorandom boolean value where true is returned with probability prob and false with probablility 1 - prob. This function can be used to realize prob, and is equivalent to generating a Bernoulli-distributed value.

Generate a pseudorandom boolean value where `true` is returned with
probability `prob` and `false` with probablility `1 - prob`. This
function can be used to realize `prob`, and is equivalent to generating
a Bernoulli-distributed value.
sourceraw docstring

rand-expclj

(rand-exp rng lambda)

Generate a pseudorandom, exponentially distributed double value with mean (/ 1 lambda), where lambda is the so-called "rate parameter".

Generate a pseudorandom, exponentially distributed double value with
mean `(/ 1 lambda)`, where `lambda` is the so-called "rate parameter".
sourceraw docstring

rand-gaussianclj

(rand-gaussian rng mean sd)

Generate a pseudorandom, normally distributed double value with mean mean and standard deviation sd.

Generate a pseudorandom, normally distributed double value with mean
`mean` and standard deviation `sd`.
sourceraw docstring

rand-intclj

(rand-int rng n)

Generate a pseudorandom, uniformly distributed integer value between 0 (inclusive) and n (exclusive).

See also: clojure.core/rand-int

Generate a pseudorandom, uniformly distributed integer value between 0
(inclusive) and `n` (exclusive).

See also: `clojure.core/rand-int`
sourceraw docstring

rand-nthclj

(rand-nth rng coll)

Randomly select an element from coll. Each element has an equal probability of being selected.

Will throw an ::empty-coll exception on an empty coll.

See also: clojure.core/rand-nth

Randomly select an element from `coll`. Each element has an equal
probability of being selected.

Will throw an `::empty-coll` exception on an empty `coll`.

See also: `clojure.core/rand-nth`
sourceraw docstring

rand-unbound-intclj

(rand-unbound-int rng)

Generate a pseudorandom, uniformly distributed integer value in the entire range of possible Java long/Clojure integer values.

Generate a pseudorandom, uniformly distributed integer value in the
entire range of possible Java long/Clojure integer values.
sourceraw docstring

rand-uuidclj

(rand-uuid rng)

Generate a pseudorandom UUID (as a string).

Generate a pseudorandom UUID (as a string).
sourceraw docstring

random-sampleclj

(random-sample rng prob)
(random-sample rng prob coll)
(random-sample rng prob coll weights)

Probabilistically sample elements from coll, where each element has prob probability of being selected. If weights are provided, then the element associated with a weight has (+ prob weight) probability (up to 1.0) of being selected. Returns a transducer when coll is not provided.

See also: clojure.core/random-sample

Probabilistically sample elements from `coll`, where each element has
`prob` probability of being selected. If `weights` are provided, then
the element associated with a weight has `(+ prob weight)` probability
(up to 1.0) of being selected. Returns a transducer when `coll` is not
provided.

See also: `clojure.core/random-sample`
sourceraw docstring

rngclj

(rng)

Create a pseudorandom RNG using an arbitrary seed value.

Create a pseudorandom RNG using an arbitrary seed value.
sourceraw docstring

seed-rngclj

(seed-rng seed)

Create a seeded deterministic, pseudorandom RNG, in which two RNGs created using the same value of seed will output the same results.

Create a seeded deterministic, pseudorandom RNG, in which two RNGs created
using the same value of `seed` will output the same results.
sourceraw docstring

shuffleclj

(shuffle rng coll)
(shuffle rng coll cnt)

Randomly shuffle coll and return a lazy sequence as the result.

See also: clojure.core/shuffle

Randomly shuffle `coll` and return a lazy sequence as the result.

See also: `clojure.core/shuffle`
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close