Returns a deferred sequence whose elements appear in random order.
Type of elements within the source iterable.
The source iterable.
A sequence containing the same elements as source but shuffled.
The implementation materialises the entire sequence into an array before shuffling, making this unsuitable for infinite sequences.
const numbers = [1, 2, 3, 4, 5];const shuffled = shuffle(numbers).toArray();console.log(shuffled); // e.g., [3, 1, 5, 2, 4] Copy
const numbers = [1, 2, 3, 4, 5];const shuffled = shuffle(numbers).toArray();console.log(shuffled); // e.g., [3, 1, 5, 2, 4]
Returns a deferred sequence whose elements appear in random order.