Skip to main content

ArrayShuffle

Takes an array and randomly reorders all of its elements, returning a new array with the same items in a different order.

Reference

Parameters

array

The array whose elements will be reordered.

Component data2-core-types@Getter

Example

Input

[1, 2, 3, 4, 5]

Output:

[3, 5, 1, 2, 4]

Note: The output order is random and will differ on each execution. All original elements are preserved, only their positions change.