Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- yobit dice вероятность выйгрыша.
- balance это с какой суммы начинаем.
- target это целевая сумма.
- ====
- Вероятность удвоить сумму 30-40 процентов
- ====
- public class Main {
- public static void main(String[] args) {
- int ok = 0;
- int target = 2000;
- for(int k = 0; k < 100; k++) {
- int balance = 1000;
- int i = 0;
- int reward = 1;
- while (balance > 0 && balance <= target && reward <= balance) {
- i++;
- int rnd = randomRange(1, 99);
- if (rnd >= 51) {
- balance -= reward;
- reward *= 2;
- } else if (rnd <= 49) {
- balance += reward;
- reward = 2;
- }
- }
- if(balance >= target) {
- System.out.println("time: " + (float)(i*8)/60/60);
- ok++;
- }
- }
- System.out.print("chance: " + ok);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement