mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
1.1 KiB
1.1 KiB
| layout |
|---|
| default |
§Function pickRandom
Random pick a value from a one dimensional array. Array element is picked using a random function with uniform distribution.
§Syntax
math.pickRandom(array)
§Parameters
| Parameter | Type | Description |
|---|---|---|
array |
Array | A one dimensional array |
§Returns
| Type | Description |
|---|---|
| Number | One of the elements of the provided input array |
§Examples
math.pickRandom([3, 6, 12, 2]); // returns one of the values in the array