Static methods
staticrandomElementExcept(this:CollectionImpl<T>, except:T, unsafe:Bool = false):T
Return a random element contained in the given array that is not equal to the except
arg.
Parameters:
except | The element we don't want |
---|---|
unsafe | If set to |
Returns:
The random element or null
if nothing was found
staticrandomElementMatchingValidator(this:CollectionImpl<T>, validator:T ‑> Bool):T
Return a random element contained in the given array that is validated by the provided validator. If no item is valid, returns null.
Parameters:
array | The array in which we extract the element from |
---|---|
validator | A function that returns true if the item is valid, false if not |
Returns:
The random element or null
if nothing was found