mathjs
Version:
Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser and offers an integrated solution to work with numbers, big numbers, complex numbers, units, and matrices.
40 lines (23 loc) • 718 B
Markdown
# Function pickRandom
Random pick a value from a one dimensional array.
Array element is picked using a random function with uniform distribution.
## Syntax
```js
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
```js
math.pickRandom([3, 6, 12, 2]); // returns one of the values in the array
```
## See also
[random](random.md),
[randomInt](randomInt.md)
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->