Hello everybody,
I need to simulate a coin flip, but with three possible outcomes, method1(), method2() and method3(). But if method1() is completed, then go to method2(), but if method2() is completed then go to method3() and so on…
Right now I came up with this working code, it does the job, but I want to ask you if it can be improved (some parts are written in pseudo-code, just to give you the idea):
void coin() {
  float coin = random(0.0, 1.0);
  if (coin < 0.3) {
    if (method1() != completed) {
      method1();
    } else {
      if (method3() != completed) {
        method3();
      } else { 
        if (method2() != completed) {
          method2();
        }
      }
    }
  } else if (coin >= 0.3 && coin < 0.6) {
    if (method2() != completed) {
      method2();
    } else {
      if (method1() != completed) {
        method1();
      } else { 
        if (method3() != completed) {
          method3();
        }
      }
    }
  } else {
    if (method3() != completed) {
      method3();
    } else {
      if (method2() != completed) {
        method2();
      } else {
        if (method1() != completed) {
          method1();
        }
      }
    }
  }
}
thank you so much 
