Can random(5) output the number 5?

Why not use java nextInt?
eg

import java.util.Random;

void setup() {
  Random rand = new Random();
  for (int i = 0; i < 1000; i++) {
    println(rand.nextInt(6));
  }
}
1 Like