Math and Simulation Methodology
This page documents exactly how the Roulette Strategy Tester simulates roulette and how every published number on the site is derived. Everything here is reviewed by Kim Birch.
1. Random number generation
Each spin draws a random integer using the browser's Math.random() function:
- European wheel:
Math.floor(Math.random() * 37)→ integer 0-36 - American wheel:
Math.floor(Math.random() * 38)→ integer 0-37, where 37 represents the 00 pocket
This is a pseudo-random generator. It is suitable for educational simulation and produces a uniform distribution across many spins. It is not certified casino RNG. We do not claim that any specific simulated session predicts any specific real-money session.
2. Wheel layout
Pocket colours follow standard casino layouts:
- Red: 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 (18 numbers)
- Black: 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 (18 numbers)
- Green: 0 (and 00 on American wheels)
3. Bet resolution
For each spin, every bet placed by the active strategy is resolved independently against the result. Bet types and payouts:
| Bet type | Numbers covered | Payout (profit:stake) |
|---|---|---|
| Straight up | 1 | 35:1 |
| Split | 2 | 17:1 |
| Street | 3 | 11:1 |
| Corner | 4 | 8:1 |
| Six line | 6 | 5:1 |
| Dozen / Column | 12 | 2:1 |
| Red / Black / Odd / Even / Low / High | 18 | 1:1 |
A winning bet returns stake + profit to the bankroll. A losing bet forfeits the stake. The engine tracks total wagered (sum of stakes), total won (sum of profits on winning bets) and total lost (sum of stakes on losing bets) separately.
4. Strategy state machines
Each supported strategy is implemented as a small state machine with two methods:
nextBets(state, ctx)- returns the list of bets to place this spin, or null if the strategy is blocked by insufficient bankroll.onResolved(state, ctx, profit, anyWin)- updates internal state based on spin outcome.
Strategy rules follow the original published logic. Martingale doubles after a loss and resets after a win. Fibonacci moves +1 step on loss and -2 on win. Labouchere bets the sum of the first and last numbers in its sequence, removes them on a win and appends the lost bet on a loss. Oscar's Grind targets a +1 unit cycle and never overshoots.
5. Bankroll tracking
After every resolved spin the engine updates:
currentBankroll- cash on hand after settlementpeakBankroll- highest bankroll seen this sessionlowestBankroll- lowest bankroll seen this sessionmaxDrawdown- largest drop from peak to subsequent lowcurrentWinningStreak/currentLosingStreaklongestWinningStreak/longestLosingStreaknumberFrequencymap of how often each pocket has hit
6. Stop conditions
- Configured spin count is reached (e.g. 100 spins).
- The strategy requests a bet larger than the remaining bankroll (busted/blocked).
- The user clicks Reset.
7. Expected loss
Expected loss is reported on the final result modal as a benchmark against actual session loss. The formula is:
Expected loss = Total wagered × House edge
- European: 1/37 ≈ 2.7027%
- American: 2/38 ≈ 5.263%
This is an educational reference. It is not a prediction of any specific run.
8. ROI
Return on investment is reported as: (Final bankroll − Initial bankroll) / Total wagered × 100. Over many sessions, mean ROI converges toward the negative house edge. Single-session ROI is dominated by variance and should not be read as edge.
9. What the engine does not model
- Table limits (we assume the strategy can place any bet the bankroll can afford).
- Casino-specific rule variants beyond European and American.
- La Partage / En Prison (on the roadmap).
- Time delay between spins.
- Player fatigue or tilt (no behavioural model).
10. Reproducibility
Each run starts from a fresh state. Results are not seeded - two runs with identical configuration will produce different spin sequences. This is intentional: real roulette is also unseeded. To compare strategies fairly, run several batches and look at averages.