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.

36 lines
680 B

  1. function coupon5() {
  2. int coup0 := 0;
  3. int coup1 := 0;
  4. int coup2 := 0;
  5. int coup3 := 0;
  6. int coup4 := 0;
  7. int draw1 := 0;
  8. int draw2 := 0;
  9. int draw3 := 0;
  10. int numberDraws := 0;
  11. while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1) | !(coup3 = 1) | !(coup4 = 1)) {
  12. draw1 := unif(0,4);
  13. draw2 := unif(0,4);
  14. draw3 := unif(0,4);
  15. numberDraws := numberDraws + 1;
  16. if(draw1 = 0 | draw2 = 0 | draw3 = 0) {
  17. coup0 := 1;
  18. }
  19. if(draw1 = 1 | draw2 = 1 | draw3 = 1) {
  20. coup1 := 1;
  21. }
  22. if(draw1 = 2 | draw2 = 2 | draw3 = 2) {
  23. coup2 := 1;
  24. }
  25. if (draw1 = 3 | draw2 = 3 | draw3 = 3) {
  26. coup3 := 1;
  27. }
  28. if (draw1 = 4 | draw2 = 4 | draw3 = 4) {
  29. coup4 := 1;
  30. }
  31. }
  32. }