I need a few lines of Java code that run a command x percent of the time at random.
psuedocode:
boolean x = true 10% of cases. if(x){ System.out.p
You can use Random. You may want to seed it, but the default is often sufficient.
Random random = new Random(); int nextInt = random.nextInt(10); if (nextInt == 0) { // happens 10% of the time... }