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
To take your code as a base, you could simply do it like that:
if(Math.random() < 0.1){ System.out.println("you got lucky"); }
FYI Math.random() uses a static instance of Random
Math.random()
Random