Skip to main content

randomFromArray

randomFromArray(random, array) ⇒ T | undefined

Kind: global function
Returns: T | undefined - returns undefined only if that value is in the array or if array is empty

ParamTypeDescription
randomfunctionif you don't have a custom RNG, you can always pass Math.random instead
arrayArray.<T>