pickRandom#
Pick a random entry from a given array.
Available in: math cells, REPL.
Syntax#
pickRandom(array)
pickRandom(array, number)
pickRandom(array, weights)
pickRandom(array, number, weights)
pickRandom(array, weights, number)
Arguments and behavior#
Chooses an element from the supplied array. A one-element array has a predictable result. The example returns scalar (number).
Example#
Edit the inputs, then use Run or Reset. Changes stay in this example.
Example
pickRandom([7])Interactive examples could not load. You can still copy the expressions.
Expected result: 7.