Miscellaneous math functions.
Miscellaneous math functions.
(durstenfeld-shuffle rng collection)
Durstenfeld version of the Fisher-Yates shuffle.
Durstenfeld version of the Fisher-Yates shuffle.
(fit-to-range value)
(fit-to-range max-value value)
(fit-to-range min-value max-value value)
Returns value' constrained to be between min-value
and max-value
inclusive.
Boundaries are 0 and 1 if not given.
Returns value' constrained to be between `min-value` and `max-value` inclusive. Boundaries are 0 and 1 if not given.
(mean sq)
Computes the mean of a sequence.
Computes the mean of a sequence.
(min-max-normalization min-value max-value value)
Normalizes a numerical value between min-value
and max-value
.
Values out of range are treated as extreme values.
Normalizes a numerical value between `min-value` and `max-value`. Values out of range are treated as extreme values.
(n-combinations n k)
Counts the number of combinations of n choose k.
Counts the number of combinations of n choose k.
(random-int rng max-int)
(random-int rng min-int max-int)
Using a given random number generator for numbers between 0 (inclusive) and 1 (exclusive), generates an integer
between min-int
(inclusive) and max-int
(exclusive).
Using a given random number generator for numbers between 0 (inclusive) and 1 (exclusive), generates an integer between `min-int` (inclusive) and `max-int` (exclusive).
(reservoir-sample-ints rng max-int n-sample)
(reservoir-sample-ints rng min-int max-int n-sample)
Randomly samples n-sample
integers between min-int
(inclusive, defaults to 0) and max-int
(exclusive).
Randomly samples `n-sample` integers between `min-int` (inclusive, defaults to 0) and `max-int` (exclusive).
(wrap-to-range value)
(wrap-to-range max-value value)
(wrap-to-range min-value max-value value)
Like fit-to-range
but the value is wrapped as if the range was cyclic.
Ex. (wrap-to-range 0 10 -3) => 6
Like `fit-to-range` but the value is wrapped as if the range was cyclic. Ex. (wrap-to-range 0 10 -3) => 6
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close