Fairness
OPDuel Originals
Limbo
Plinko
Keno
Roulette
Mines
Blackjack
Roll
Dice
Provably Fair Mines
Mines places hidden bombs randomly on a 5×5 grid before each round. Reveal tiles to find gems and increase your multiplier - but hit a mine and you lose. More mines means higher risk and higher potential reward.
Verify Game Fairness
Mine positions are determined using selection without replacement, ensuring fair and random placement.
The Algorithm
// Step 1: Generate floats (one per mine)
const floats = [];
let round = 0;
let byteIndex = 0;
let hash = [];
while (floats.length < mineCount) {
if (byteIndex === 0 || byteIndex >= 32) {
const message = `${clientSeed}:${nonce}:${round}`;
hash = HMAC_SHA256(serverSeed, message);
byteIndex = 0;
round++;
}
const bytes = hash.slice(byteIndex, byteIndex + 4);
let float = 0;
for (let i = 0; i < 4; i++) {
float += bytes[i] / Math.pow(256, i + 1);
}
floats.push(float);
byteIndex += 4;
}
// Step 2: Place mines without replacement
const pool = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24];
const minePositions = [];
for (let i = 0; i < mineCount; i++) {
const index = Math.floor(floats[i] * pool.length);
minePositions.push(pool.splice(index, 1)[0]);
}How It Works
- Generate floats - Create one random float per mine. Each float requires 4 bytes from the hash. If more than 8 mines are needed, multiple hash rounds are generated.
- Create position pool - Start with all 25 grid positions (0-24). Positions are numbered left-to-right, top-to-bottom.
- Selection without replacement - For each mine:
- Multiply the float by the remaining pool size
- Floor to get an index
- Place a mine at that position and remove it from the pool
This ensures mines cannot overlap and every position has an equal probability of containing a mine.
Example
Given these inputs:
- Server Seed:
c5e7146c5863d7d647c93ffe7d4ec13fffbb7311108fab0c067d97bcc2b32d55 - Client Seed:
LuckyClientSeed777 - Nonce:
2 - Grid:
5×5 (25 positions) - Mines:
5
The hash produces floats:
[0.53654162, 0.03343367, 0.32229313, 0.37787813, 0.91198933]Selection without replacement:
| Mine | Float | Pool Size | Index | Position |
|---|---|---|---|---|
| 1 | 0.536542 | 25 | floor(0.536542 × 25) = 13 | 13 |
| 2 | 0.033434 | 24 | floor(0.033434 × 24) = 0 | 0 |
| 3 | 0.322293 | 23 | floor(0.322293 × 23) = 7 | 8 |
| 4 | 0.377878 | 22 | floor(0.377878 × 22) = 8 | 10 |
| 5 | 0.911989 | 21 | floor(0.911989 × 21) = 19 | 23 |
Mine positions (sorted): 0, 8, 10, 13, 23.
Grid Position Reference
┌────┬────┬────┬────┬────┐
│ 0 │ 1 │ 2 │ 3 │ 4 │
├────┼────┼────┼────┼────┤
│ 5 │ 6 │ 7 │ 8 │ 9 │
├────┼────┼────┼────┼────┤
│ 10 │ 11 │ 12 │ 13 │ 14 │
├────┼────┼────┼────┼────┤
│ 15 │ 16 │ 17 │ 18 │ 19 │
├────┼────┼────┼────┼────┤
│ 20 │ 21 │ 22 │ 23 │ 24 │
└────┴────┴────┴────┴────┘
