public static GetRandomFunc() {
switch((int)(Math.random()*NUM_FUNCTIONS) {
case 0:
functionA();
break;
case 1:
functionB();
break;
case 2:
functionC();
break;
// ...
}
}
I want to call GetRandomFunc() in main randomly until each function has been called once and then it ends. How do I make sure a function would be called once only, and if all has been called, it prints out System.out.println(“All done”)
create a list containing 0,1 and 2. shuffle it and iterate over it to call each function once but in random order.
and your function will be