fix: #3088 error in the description of the return type of pickRandom

This commit is contained in:
Jos de Jong 2023-11-01 12:36:15 +01:00
parent f9ab3a1073
commit 76c4811484
2 changed files with 4 additions and 5 deletions

View File

@ -50,8 +50,8 @@ export const createPickRandom = /* #__PURE__ */ factory(name, dependencies, ({ t
* @param {Array | Matrix} array A one dimensional array
* @param {Int} number An int or float
* @param {Array | Matrix} weights An array of ints or floats
* @return {number | Array} Returns a single random value from array when number is 1 or undefined.
* Returns an array with the configured number of elements when number is > 1.
* @return {number | Array} Returns a single random value from array when number is undefined.
* Returns an array with the configured number of elements when number is defined.
*/
return typed(name, {
'Array | Matrix': function (possibles) {

5
types/index.d.ts vendored
View File

@ -2275,9 +2275,8 @@ export interface MathJsInstance extends MathJsFactory {
* @param array A one dimensional array
* @param number An int or float
* @param weights An array of ints or floats
* @returns Returns a single random value from array when number is 1 or
* undefined. Returns an array with the configured number of elements
* when number is > 1.
* @returns Returns a single random value from array when number is undefined.
* Returns an array with the configured number of elements when number is defined.
*/
pickRandom<T>(array: T[]): T
pickRandom<T>(array: T[], number: number): T[]