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

Method choice

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

Return a random value from the list. Throws an exception if there are no entries available. (Can't just return null because IntList and FloatList can't do that, and would be inconsistent.)

()

Source from the content-addressed store, hash-verified

583 * can't do that, and would be inconsistent.)
584 */
585 public String choice() {
586 if (count == 0) {
587 throw new ArrayIndexOutOfBoundsException("No entries in this StringList");
588 }
589 return data[(int) (Math.random() * count)];
590 }
591
592
593 // removing in 4.0.2, seems like overkill... if something this specific is

Callers

nothing calls this directly

Calls 1

randomMethod · 0.45

Tested by

no test coverage detected