Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2016
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. yobit dice вероятность выйгрыша.
  2. balance это с какой суммы начинаем.
  3. target это целевая сумма.
  4.  
  5. ====
  6. Вероятность удвоить сумму 30-40 процентов
  7. ====
  8. public class Main {
  9. public static void main(String[] args) {
  10. int ok = 0;
  11. int target = 2000;
  12. for(int k = 0; k < 100; k++) {
  13. int balance = 1000;
  14. int i = 0;
  15. int reward = 1;
  16. while (balance > 0 && balance <= target && reward <= balance) {
  17. i++;
  18. int rnd = randomRange(1, 99);
  19. if (rnd >= 51) {
  20. balance -= reward;
  21. reward *= 2;
  22. } else if (rnd <= 49) {
  23. balance += reward;
  24. reward = 2;
  25. }
  26.  
  27. }
  28. if(balance >= target) {
  29. System.out.println("time: " + (float)(i*8)/60/60);
  30. ok++;
  31. }
  32. }
  33. System.out.print("chance: " + ok);
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement