Advertisement
Guest User

Vice President

a guest
Mar 25th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. lowWins = 0;
  2. highWins = 0;
  3. for i=(1:1:500000)
  4. lowSum = 0;
  5. for low_rolls = (1:1:9)
  6. lowSum = lowSum + randi(4);
  7. end
  8. highSum = 0;
  9. for high_rolls = (1:1:6)
  10. highSum = highSum + randi(6);
  11. end
  12. if lowSum > highSum
  13. lowWins = lowWins + 1;
  14. end
  15. if lowSum < highSum
  16. highWins = highWins + 1;
  17. end
  18.  
  19. end
  20.  
  21. sprintf("Mandy: %f %", lowWins/5000)
  22. sprintf("Randy: %f %", highWins/5000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement