MCPcopy Create free account
hub / github.com/benfry/processing4 / shuffle

Method shuffle

core/src/processing/data/LongList.java:645–656  ·  view source on GitHub ↗

Randomize the order of the list elements. Note that this does not obey the randomSeed() function in PApplet. @webref intlist:method @webBrief Randomize the order of the list elements

()

Source from the content-addressed store, hash-verified

643 * @webBrief Randomize the order of the list elements
644 */
645 @SuppressWarnings("unused")
646 public void shuffle() {
647 Random r = new Random();
648 int num = count;
649 while (num > 1) {
650 int value = r.nextInt(num);
651 num--;
652 long temp = data[num];
653 data[num] = data[value];
654 data[value] = temp;
655 }
656 }
657
658
659 /**

Callers

nothing calls this directly

Calls 1

randomMethod · 0.45

Tested by

no test coverage detected