Unfortunately, this system will not work. Nor will
"systems" like doubling up, and things like that. In
fact, on any "fair" roulette wheel, you will lose
slowly, on average. You'll lose faster on an
American wheel than a European wheel, because
the American wheel has two zeroes rather than
one.

The only way to beat roulette is either to find an
unbalanced wheel (in which case you can get a
slight edge - but probably not enough to outweigh
the house percentage); or to use Newtonian
physics and some fancy maths to predict where the
ball will land, just before betting closes. The
latter has been tried (and works), using computers
concealed in shoes etc, but most casinos are wise
to this and you will not get very far.

//Budget $100. Bet $5 on any number until you win. When you win then bet the winnings plus what is left of the $100 on any number.//

So what do you do when you've spent all the money and haven't won? There are 37 (or 38) numbers, and you've only got 20 goes in your $100, so the chances are you'll go bust.
For the french table, with 37 slots:
Chance of zero successes : (36/37)^20=0.538
So over half the time you fail at the first hurdle.
Obviously, you've a 36 in 37 (or 37 in 38) chance of failure at the 'all in' phase.

Probability of success : (1-0.538)*1/37=0.0114
At just over 1%, these arn't great odds.

I expect you are thinking of probabilities as
additive where they should be multiplicative.

The odds of your losing 20 times in a row (i.e.,
blowing your whole stake) is (1-[1/37])^20. Start
from there and work forward.

I wrote a small program that simulates this, using a
European (single-zero) model. On average
(averaged over 1,000,000 games), you lose. You'd
lose more on a US (double-zero) wheel.

Also, did you not notice that (a) lots of people play
roulette (b) this is a fairly simple scheme and yet
(c) nobody has consistently got rich playing
roulette without actually cheating?

It's the same basic idea as "doubling up" on an
evens bet. Yes, if you continue for an infinite
number of goes, you will win - but your winning
becomes infinitesimal as you approach infinity. It's
more likely that you will run out of stake money
before winning.

//It's the same basic idea as "doubling up" on an
evens bet. Yes, if you continue for an infinite number
of goes, you will win - but your winning becomes
infinitesimal as you approach infinity. It's more likely
that you will run out of stake money before winning.//

The difference here seems to be that I never need to
bet more than I have budgeted.

There's two different plays here, the "before" winning
strategy ($5) and the "after" winning strategy ($all-in)
But assuming you win once, before running out of your
$100, that means putting your entire stake on a single spin -
since the odds are still 37/1 (or 38/1) - can you explain the
reasoning
that suggests changing strategies after the initial win? i.e.
why not play all-in on your initial spin?

Yes, but you will lose most of the time. If you play
once, starting with $100, there is a roughly 57%
chance that you will go through it all without a
win.

But suppose you win on your 10th spin. You now
have $180 in winnings, plus $50 left. You bet $185
on the next spin. You will probably (36/37) lose,
leaving you with $45. And you will probably lose
that $45 (in 9x $5 bets) without winning again.

Even if you win on that $185 bet (winning $185 x
36), you will then bet all your winnings plus $5 on
your next spin, and will probably (36/37) lose,
leaving you with $40...

Etc. etc. etc.

You can consider other permutations but,
statistically, you lose overall. Seriously - I'm sure
you can program in some language or another, so
write a script and test it yourself.

//But suppose you win on your 10th spin. You now
have $180 in winnings, plus $50 left. You bet $185 on
the next spin. You will probably (36/37) lose, leaving
you with $45. And you will probably lose that $45 (in
9x $5 bets) without winning again.

Even if you win on that $185 bet (winning $185 x 36),
you will then bet all your winnings plus $5 on your
next spin, and will probably (36/37) lose.//

Yes - but this is not my system. You would bet
$185+$50 on one number.

The payout is directly equivalent to the odds - but
only after you disregard the zero (or zeroes). So,
if you bet on red (or on black) or on odd (or even)
the payout is 2:1; if you bet on one of the 36
numbers, it's 36:1; etc.

The house makes its share from the zero (or
zeroes): if you bet on red, or on a number, and it
comes up zero, the house wins. Because American
roulette has two zeroes, the house take is twice as
high as in European roulette, so that people can be
in and out of the casino as fast as possible.

Roulette is a school in applied probability; its cost depends on how
you play and how you learn. If you pretend to play, and really pay
attention, you can learn very cheaply. If you really play, but only
pretend to pay attention, the tuition will take everything you have.

Why the two random generation if tests? Surely the real world example is only one if. The test either being a random against a const choice or matching two random numbers.

//Your original code didn't make you lose the $100
when you win a bet, and bet the winnings and remains
of the $100, and lose it.//

The code you post is incorrect since there is a path
through your program which has you lose the 100
dollars twice however my code does necessarily take
away the 100 dollars.

New critique: Your original code continued to bet the $100 when you win a bet, and bet the winnings and remains of the $100, and lose it. It didn't distinguish that case from when you simply hasn't won yet.

[wjt] not sure if that's addressed to me, But the reason I have two "if" conditions is one is for the $5 bet, and the other one is for being the winnings plus what's left of the $100

Caspian is correct. The betting scheme is DOA. Too
bad it could not work but perhaps there is something
to this "mathematics" thing after all. I am eternally
grateful for this since I was almost ready to go to the
casino. Very disappointed!!

[either caspian or zelah] I'm still not understanding the code. Don't you have to take the second $5 off your $100 if you are only doing 20 bets. This is probably just my stupidity.

If you mean a second $5 for the next bet after a winning $5 bet, no, the next bet isn't for $5, it's for all that remains of the $100. If you lose you jump out of the loop that counts down the $100, because there's none left.

If you mean a second $5 for the next $5 bet after losing the $5, that happens next time around the loop, there isn't another bet until then.

From the code It looks like the betting is stopped if there is the 'rest in' bet win even though the rest amount is returned and the $5 loops can carry on.

The key to the method, I thought, was repeat until $100 no more.

Enter with 100$. Worst senario leave with 0$ (usual). Best senario
10 211 280 550 505 056 301 907 102 295 654 400$ (heart of gold with fresh cuppa).
This assumes the casino doesn't forcibly remove you.