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

Method shuffle

core/src/processing/data/FloatList.java:671–682  ·  view source on GitHub ↗

Randomize the order of the list elements. @webref floatlist:method @webBrief Randomize the order of the list elements

()

Source from the content-addressed store, hash-verified

669 * @webBrief Randomize the order of the list elements
670 */
671 @SuppressWarnings("unused")
672 public void shuffle() {
673 Random r = new Random();
674 int num = count;
675 while (num > 1) {
676 int value = r.nextInt(num);
677 num--;
678 float temp = data[num];
679 data[num] = data[value];
680 data[value] = temp;
681 }
682 }
683
684
685 /**

Callers

nothing calls this directly

Calls 1

randomMethod · 0.45

Tested by

no test coverage detected