Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. private static boolean successfulAttendance(){
  2.  
  3. boolean result;
  4. double random = Math.random();
  5. double percentage = getPercentageFromTime();
  6.  
  7. if(random<percentage){ //percentage = 0.3
  8. result = true;
  9. } else {
  10. result = false;
  11. }
  12.  
  13. return result;
  14. }
  15.  
  16.  
  17. private static void distributionOfWins(){
  18.  
  19. int amountOfTrue = 0;
  20. int amountOfFalse = 0;
  21.  
  22. System.out.println("Durchgänge: " + Integer.MAX_VALUE + " Gewinnwahrscheinlichkeit: " + getPercentageFromTime() * 100 + "%");
  23.  
  24. for (int i = 0; i < Integer.MAX_VALUE; i++){
  25. if (successfulAttendance()){
  26. amountOfTrue++;
  27. } else {
  28. amountOfFalse++;
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement