You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
337 B

  1. function coupon3() {
  2. int coup0 := 0;
  3. int coup1 := 0;
  4. int coup2 := 0;
  5. int draw := 0;
  6. int numberDraws := 0;
  7. while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1)) {
  8. draw := unif(0,2);
  9. numberDraws := numberDraws + 1;
  10. if(draw = 0) {
  11. coup0 := 1;
  12. }
  13. if(draw = 1) {
  14. coup1 := 1;
  15. }
  16. if(draw = 2) {
  17. coup2 := 1;
  18. }
  19. }
  20. }