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

Method shuffle

core/src/processing/data/StringList.java:549–560  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

547 * @webBrief Randomize the order of the list elements
548 */
549 @SuppressWarnings("unused")
550 public void shuffle() {
551 Random r = new Random();
552 int num = count;
553 while (num > 1) {
554 int value = r.nextInt(num);
555 num--;
556 String temp = data[num];
557 data[num] = data[value];
558 data[value] = temp;
559 }
560 }
561
562
563 /**

Callers

nothing calls this directly

Calls 1

randomMethod · 0.45

Tested by

no test coverage detected