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

Method shuffle

core/src/processing/data/IntList.java:646–657  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

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

Callers 1

wordsFolderExhaustMethod · 0.45

Calls 1

randomMethod · 0.45

Tested by

no test coverage detected