shuffle

Static shuffle 

Source
pub static shuffle: ShuffleInternalType
Expand description

Randomizes the order of the elements of an array. Implements Fisher-Yates Shuffle Algorithm.

Examples

function setup() {
  let regularArr = ['ABC', 'def', createVector(), TAU, Math.E];
  print(regularArr);
  shuffle(regularArr, true); // force modifications to passed array
  print(regularArr);

  // By default shuffle() returns a shuffled cloned array:
  let newArr = shuffle(regularArr);
  print(regularArr);
  print(newArr);
}

Parameters

array Array to shuffle

bool? modify passed array