shuffle
优质
小牛编辑
135浏览
2023-12-01
Creates a new sequence with the same elements as this one, in a randomized order.
Signature
Sequence.shuffle = function() { /*...*/ }
Sequence.shuffle = function shuffle() { return new ShuffledSequence(this); }
Name | Type(s) | Description |
---|---|---|
returns | Sequence | The new sequence. |
Examples
Lazy([1, 2, 3, 4, 5]).shuffle().value() // =~ [1, 2, 3, 4, 5] Lazy([]).shuffle().value() // => [] Lazy([1]).shuffle().each(Lazy.noop) // => true Lazy([]).shuffle().each(Lazy.noop) // => true