(rand)
(rand rng)
returns a random double between 0 and 1
(rand) ;;0.19755427425784822 => number?
(rand (rand-gen)) ;;0.8479218396605446 => number?
returns a random double between 0 and 1 (rand) ;;0.19755427425784822 => number? (rand (rand-gen)) ;;0.8479218396605446 => number?
(rand-gen)
(rand-gen seed)
(rand-gen seed type)
creates a random number generator
(rand-gen) => org.apache.commons.math3.random.MersenneTwister
creates a random number generator (rand-gen) => org.apache.commons.math3.random.MersenneTwister
(rand-int n)
(rand-int n rng)
returns a random integer less than n
(rand-int 100) ;; 16 => integer?
returns a random integer less than `n` (rand-int 100) ;; 16 => integer?
(rand-normal)
(rand-normal rng)
returns a random number corresponding to the normal distribution
(rand-normal) ;;-0.6591021470679017 => number?
returns a random number corresponding to the normal distribution (rand-normal) ;;-0.6591021470679017 => number?
(rand-nth coll)
(rand-nth coll rng)
returns a random element in an array
(rand-nth [:a :b :c]) => #{:a :b :c}
returns a random element in an array (rand-nth [:a :b :c]) => #{:a :b :c}
(rand-seed! seed)
(rand-seed! rng seed)
sets the seed of a given random number generator
(-> (rand-gen) (rand-seed! 10) (rand)) => 0.77132064549269
sets the seed of a given random number generator (-> (rand-gen) (rand-seed! 10) (rand)) => 0.77132064549269
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close