I lately got interested into betting systems, dice strategies and algorithms. I took some time to think about it and eventually ended up with an algorithm of my own. Considering that I don't have unlimited money that would allow me to test it on a real dice betting site (duh), I have coded a simulation that allows me to run my algorithm in an environment that reproduces those websites.Although I have not tested it in extreme conditions (really large number of rolls) it seems to work pretty well, and I never got my simulation going out of bankroll or even finish the algorithm with less bankroll than it started with. I have commented this so it is clear to everyone what I was thinking and why is every operation doing.public static void Main(string[] args){    simulation1(0.000001, 1.1, 1.09, 10.9, 0.01, 10);}/*                |       |     |    |     |     L-->  This is the number of Big Wins you want to play. The simulation will                     |       |     |    |     |               play until that number is reached.                   |       |     |    |     L------->   This is your initial Balance. The simulation will stop and warn you if                   |       |     |    |                     any bet gets too big for your actualBalance, but you gotta start                    |       |     |    |                     with something.                   |       |     |    L------------->   This is The multiplicator after loss. Basically, when you lose, the                    |       |     |                          next bet(s) will be multiplicated by this amount until you win again,                   |       |     |                          which will be a Big Win and is gonna reset your iterations.                   |       |     L------------------>   This is the multiplicator after win. While you have not lost yet (meaning                   |       |                                that since last Big Win you are on a straight win streak) every                    |       |                                next bet will be multiplicated by this amount.                     |       L------------------------>   This is the Payout of the bets you are playing.                   L-------------------------------->   Finally, that is the value of your first base bet. Every time a Big Win                                                             is achieved, your bets will be reset to this value and will grow again                                                            until next one.*///  Here is the 'brain' of the algorithm. I have included in it some commented lines, noted C/U that you can uncomment to see datas //  in the shell as the program runs. For example, what number did you roll, was it a win or a loss, what while loop were you in, //  etc... Be careful, although uncommenting those lines will not change anything about the running capacity of the algorithm, the more // you display, the less easy to read it becomes..public static void simulation1(double base_bet, double payout, double mult_post_victoire, double mult_post_defaite, double Balance, int nb_victoires_avt_stop){    Console.WriteLine(----------START---------- );                                // C/U //   shows where the loop begins.    Console.WriteLine(number of remaining Big Wins =  + nb_victoires_avt_stop);   // C/U //   displays the number of remaining Big wins, which is                                                                                     //          also the remaining number of loops.               if (nb_victoires_avt_stop == 0)                                                 //          Stopping Condition. If the number of big wins reach                                                                                    //          zero, you stop the algorithm and are done.    {        Console.WriteLine(----------FINISH----------); Console.WriteLine(balance =  + Balance);     // C/U //   shows where the program stops to                                                                                    //          run, and displays your final Balance; if it's bigger                                                                                    //          than your initial balance, without having returned                                                                                    //          any errors during the run, no bets have been too high                                                                                    //          for your bankroll -> it's a success.        for (int i = 0; i < 10; i++)        {            Console.WriteLine();                                                  // C/U //   some blank lines before starting again. It's here                                                                                    //          mostly to keep it easily readable when you simulate                                                                                    //          repeatedly.         }        return;    }    double chance_victoire = (99 / payout);                                         //          Your chance of winning, influed by the payout you                                                                                    //          defined. Here it is '99' because the house edge is                                                                                    //          considerated to be 1%. You can adjust it for a                                                                                    //          different house edge if you want.    Console.WriteLine(chance to win =  + chance_victoire + %);                  // C/U //   displays your chance to win.    bool A_perdu = false;                                                           //          this bool starts at false ; as soon as a loss is                                                                                    //          encountered, it switches to true, and changes the                                                                                    //          operating while loop.    double bet = base_bet;                                                          //          your base bet. it is gonna grow, but you've got to                                                                                    //          keep the value of base_bet variable untouched to                                                                                    //          reset at every big win, so we make a clone for the                                                                                    //          actual turn.    //Console.WriteLine(A_perdu = + A_perdu);    while (A_perdu == false)                                                        //          This loop is active while you have not reached a lose    {        //Console.WriteLine(LOOP 1 );                                             // C/U //   debug tool -> in case you want to know, at every bet,                                                                                    //          in which loop you are. Should write LOOP 1 until you                                                                                    //          lose. Then you wont get into that loop until next                                                                                    //          reset.        //Console.WriteLine(bet =  + bet);                                        // C/U //   displays your bet before each roll. You can watch it                                                                                    //          gradually grow.        Thread.Sleep(1);                                                            //          Very Important to keep the simulation running without                                                                                    //          bugs. If we dont wait, the next bunch of rolls will                                                                                    //          have the same value (because random is pseudo-random,                                                                                    //          based on time, and if it is too fast you have the                                                                                    //          time to make several bets before changing to next                                                                                    //          millisecond, which will change the random value        double tirage = RandomNumber();                                             //          Rolls a random number between 0 and 1        //Console.WriteLine(roll =  + tirage);                                    // C/U //   Display your roll. In case you want to verify that no                                                                                    //          rolls ar identical, or predictable, or unevenly                                                                                    //          reparted.        Balance -= bet;        if (Balance <= 0)                                                           //          after each bet, if your balance is negative, it means                                                                                    //          that in real conditions you wouldn't have had                                                                                    //          enough bankroll.        {            Console.WriteLine(ERROR BALANCE NEGATIVE);            return;        }        if (tirage < (chance_victoire / 100))                                       //          Calculates if your roll is a winning roll or not.        {            Console.WriteLine(win);                                               // C/U //   Displays if you roll is winning.              Balance += (payout * bet);            bet *= mult_post_victoire;                                              //          Multiply bet by the value you chose, while its a win                                                                                    //          streak it keeps looping in this while            //Console.WriteLine(balance_win =  + Balance);                        // C/U //   watch your balance evolve in real time.        }        else        {            Console.WriteLine(-----------------------lose);                       // C/U //   Displays if your roll is losing.             bet *= mult_post_defaite;                                               //          multiply your bet by the value after lose you defined            //Console.WriteLine(balance_lose =  + Balance);                       // C/U //   Watch your balance evolve in real time            A_perdu = true;                                                         //          switches the bool to true, to enter the second loop.         }    }    while (A_perdu == true)                                                         //          You enter this loop once you have lost one time.    {        //Console.WriteLine(LOOP 2 );                                             // C/U //   If you want to see in which loop you are.         //Console.WriteLine(bet =  + bet);                                                                    Thread.Sleep(1);        double tirage = RandomNumber();        //Console.WriteLine(roll =  + tirage);        Balance -= bet;        if (Balance <= 0)        {            Console.WriteLine(ERROR BALANCE NEGATIVE);            return;        }        if (tirage >= (chance_victoire / 100))                                      //          While you keep losing, you keep multiplying your bet                                                                                    //          by the same amount.         {            Console.WriteLine(-----------------------lose);            bet *= mult_post_defaite;            //Console.WriteLine(balance_lose =  + Balance);        }        else                                                                        //          As soon as you win, it is a Big Win, the whole turn                                                                                    //          is finished, you can reset the algorithm.        {            Console.WriteLine(win);            Balance += (payout * bet);            //Console.WriteLine(balance =  + Balance);            simulation1(base_bet, payout, mult_post_victoire, mult_post_defaite, Balance, nb_victoires_avt_stop - 1);   // That resets the simulation                                                                                    //          with slightly different parameters : your actual                                                                                    //          balance as value os initial balance, and the                                                                                    //          remaining number of big wins decreased by one.             return;                                                                 //          at some point the last iteration, with remaininng big                                                                                    //          wins == 0, will return, so like a waterfall every                                                                                    //          precedent function will return. You can see it like                                                                                    //          an inception dreams in dreams unless there, it is a                                                                                    //          function in a function in a function... when the very                                                                                    //          last function ends, it comes back to the immediate                                                                                    //          previous one, which does the same until we reach the                                                                                    //          first one, that returns the final value of the                                                                                    //          simulation.        }    }}public static double RandomNumber()             //  This function is here to generate a random number between 0 and 1, and reproduce (emulate) the                                                //  behavior of any dice site's roll system. {    int seed = DateTime.Now.Millisecond;    double number;    Random rnd = new Random(seed);    number = rnd.NextDouble();    return number;}Is my simulation really doing its job properly? Are my dice rolls really random? Is my strategy working as it should, or am I missing something?I also ran it into Tutorialspoint coding ground here (same code, uncommented).
Betting strategy simulation
c#;algorithm;simulation