Plinko guide
Dragon Plinko: mapping a hash to every peg bounce
The dragon name is only a label, chosen for the page, and it hides no special mechanics. This page traces one 15-row drop from a hash digest down to its final slot, one row at a time.
Why plinko needs many random numbers
A dice roll needs one random value. A plinko drop needs one per row, because each peg makes its own left-or-right decision. A 15-row drop therefore needs 15 independent values. In the construction shown here, each value comes from 4 bytes of an HMAC-SHA256 digest. One digest has 32 bytes, so it yields 8 values; a 15-row drop uses the full first digest and 7 values from a second one.
| Server seed (revealed later) | dragon-srv-b81e04 |
|---|---|
| Commitment shown before play: SHA-256(server seed) | e65e003dfeb235f4a81b734535470ad395b1e107d0c0db3a5687240c74990a30 |
| Client seed : nonce : round | dragon-player-22:41:0 |
| HMAC-SHA256(server seed, message) | 0b462b7606c368cdee232fb0a1866d94acb2827e7acbce41e38e43d9c8f7faeb |
| First 4 bytes (8 hex digits) | 0b462b76 = 189,148,022 |
| Float = value / 2^32 | 0.0440394557 |
| 15 floats, one per row (>= 0.5 goes right) | LLRRRLRRLRLLRRR |
| Final slot = number of R | 9 |
One common construction, shown for teaching. Real services document their own message format; check theirs before verifying.
Bytes to float to direction
- Build the message
client seed:nonce:round. The round starts at 0 and goes up by one each time a new digest is needed. - Compute HMAC-SHA256 with the server seed as the key. The result is 32 bytes, shown as 64 hex digits.
- Read the bytes in groups of 4. Each group is a whole number from 0 to 2^32 - 1 = 4,294,967,295.
- Divide each number by 2^32 to get a float in [0, 1).
- Map each float to a bounce: 0.5 or more goes right, below 0.5 goes left.
- Count the right bounces. That count is the slot.
| Row | Digest (round) | Float | Bounce |
|---|---|---|---|
| 1 | 0 | 0.04403946 | left |
| 2 | 0 | 0.02641921 | left |
| 3 | 0 | 0.93022440 | right |
| 4 | 0 | 0.63095746 | right |
| 5 | 0 | 0.67459884 | right |
| 6 | 0 | 0.47967233 | left |
| 7 | 0 | 0.88888954 | right |
| 8 | 0 | 0.78503388 | right |
| 9 | 1 | 0.06470443 | left |
| 10 | 1 | 0.61805169 | right |
| 11 | 1 | 0.19458772 | left |
| 12 | 1 | 0.03755007 | left |
| 13 | 1 | 0.93665458 | right |
| 14 | 1 | 0.58167401 | right |
| 15 | 1 | 0.73488847 | right |
The first eight rows come from the round-0 digest and the last seven from the round-1 digest. Because the threshold is exactly half the range, each bounce has a 50/50 chance, which is what makes the slot follow the binomial distribution on 32,768 equally likely routes.
Why the mapping does not bias the board
Each 4-byte group is uniform over 2^32 values, and exactly half of those values are 2^31 or more. So the left and right halves are the same size, with no remainder to tilt the odds. Other services may map differently, for example by taking one bit per row; the requirement is only that each direction gets an equal share. The hash fairness guide covers the general idea.