Liking cljdoc? Tell your friends :D

io.randomseed.utils.vec

Random utils, vector utilities.

Random utils, vector utilities.
raw docstring

get-rand-nthclj

(get-rand-nth v)
(get-rand-nth v rng)

Returns a random element of the given vector. When the second argument is present it should be an instance of random number generator used to get the random position.

Returns a random element of the given vector. When the second argument is present it
should be an instance of random number generator used to get the random position.
sourceraw docstring

mergeclj

(merge v1 v2)

Merges two vectors.

Merges two vectors.
sourceraw docstring

of-stringsclj

(of-strings coll)
(of-strings coll skip-if)

Ensures that the given collection or a single value is a non-empty vector of strings. Optional function can be given to skip matching input argument and leave it as is.

Ensures that the given collection or a single value is a non-empty vector of
strings. Optional function can be given to skip matching input argument and leave
it as is.
sourceraw docstring

pairsclj

(pairs coll)

Partitions a vector into pairs.

Partitions a vector into pairs.
sourceraw docstring

rand-nthsclj

(rand-nths coll)
(rand-nths coll num)
(rand-nths coll num rng)

Returns a vector with the given number of randomly selected elements of the given vector. No element will be selected more than once.

Returns a vector with the given number of randomly selected elements of the given
vector. No element will be selected more than once.
sourceraw docstring

replace-by-lastclj

(replace-by-last v index)

Removes an element under the given index from a vector by replacing it with the last one. For the last element index it simply removes it.

Removes an element under the given index from a vector by replacing it with the
last one. For the last element index it simply removes it.
sourceraw docstring

shuffleclj

(shuffle coll)
(shuffle coll rng)

Like clojure.core/shuffle but makes use of custom random number generator.

Like clojure.core/shuffle but makes use of custom random number generator.
sourceraw docstring

split-atclj

(split-at idx v)

Splits vector at the given index.

Splits vector at the given index.
sourceraw docstring

swapclj

(swap v index-1 index-2)

Swaps two elements of a vector.

Swaps two elements of a vector.
sourceraw docstring

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

× close