Skip to main content

shuffle

Returns : Array


Takes an array and randomly shuffles it, returning the same (but shuffled) array. It does not create a new Array.

var array = [1, 2, 3, 4, 5];

gsap.utils.shuffle(array); // returns the same array, but shuffled like [2, 5, 3, 1, 4]

Parameters

  1. target : Array - The array to shuffle (in place).