Liking cljdoc? Tell your friends :D

hara.math.base.random


+default+clj


randclj

(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?
raw docstring

rand-genclj

(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
raw docstring

rand-intclj

(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?
raw docstring

rand-normalclj

(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?
raw docstring

rand-nthclj

(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}
raw docstring

rand-seed!clj

(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
raw docstring

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

× close