(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-digits n)
constructs a n digit string
(rand-digits 10) ;; "9417985847" => string?
constructs a n digit string (rand-digits 10) ;; "9417985847" => string?
(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-sample coll proportions)
(rand-seed! seed)
(rand-seed! rng seed)
sets the seed of a given random number generator
(-> (rand-gen) (rand-seed! 10) (rand)) => (any 0.77132064549269 0.5711645232847797)
sets the seed of a given random number generator (-> (rand-gen) (rand-seed! 10) (rand)) => (any 0.77132064549269 0.5711645232847797)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close