mirror of
https://github.com/josdejong/mathjs.git
synced 2025-12-08 19:46:04 +00:00
23 lines
627 B
JavaScript
23 lines
627 B
JavaScript
module.exports = {
|
|
'name': 'pickRandom',
|
|
'category': 'Probability',
|
|
'syntax': [
|
|
'pickRandom(array)',
|
|
'pickRandom(array, number)',
|
|
'pickRandom(array, weights)',
|
|
'pickRandom(array, number, weights)',
|
|
'pickRandom(array, weights, number)'
|
|
],
|
|
'description':
|
|
'Pick a random entry from a given array.',
|
|
'examples': [
|
|
'pickRandom(0:10)',
|
|
'pickRandom([1, 3, 1, 6])',
|
|
'pickRandom([1, 3, 1, 6], 2)',
|
|
'pickRandom([1, 3, 1, 6], [2, 3, 2, 1])',
|
|
'pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])',
|
|
'pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)'
|
|
],
|
|
'seealso': ['random', 'randomInt']
|
|
};
|