Random-Choice Calculator
Try Change Random-choice bits from 16 to 8.
Observe Compare Possible pairs and At least one duplicate with 16 and 8 random-choice bits.
Explain Explain why reducing random-choice bits from 16 to 8 changes expected matching pairs.
Calculate
Reset
Technical boundaries. The calculator uses the birthday approximation for uniform, independent choices within one collision domain. Its reference thresholds do not supply your system's consequence, recovery, or acceptance target.
Try It: Random-Choice Calculator
The calculator uses the (n(n-1)) approximation. Change one input at a time and describe the model before interpreting the percentage.
viewof birthdayDevices = Inputs. range ([1 , 10000 ], {value : 250 , step : 1 , label : "Independent choices (n)" })
viewof birthdayBits = Inputs. select ([8 , 12 , 16 , 20 , 24 , 32 , 48 , 64 ], {value : 16 , label : "Random-choice bits" })
{
const m = 2 ** birthdayBits;
const pairs = birthdayDevices * (birthdayDevices - 1 ) / 2 ;
const lambda = pairs / m;
const probability = lambda > 700 ? 1 : 1 - Math . exp (- lambda);
const n10 = Math . ceil ((1 + Math . sqrt (1 - 8 * m * Math . log (0.9 ))) / 2 );
const n50 = Math . ceil ((1 + Math . sqrt (1 - 8 * m * Math . log (0.5 ))) / 2 );
return html `<div style="background:#f8f9fa;border-left:4px solid #16a085;border-radius:8px;padding:1rem;font-family:system-ui,sans-serif">
<table style="width:100%;border-collapse:collapse">
<tr><th style="text-align:left;padding:.35rem">Model quantity</th><th style="text-align:right;padding:.35rem">Value</th></tr>
<tr><td style="padding:.35rem">Choice space</td><td style="text-align:right;padding:.35rem">2<sup> ${ birthdayBits} </sup> = ${ m. toLocaleString ()} </td></tr>
<tr><td style="padding:.35rem">Possible pairs</td><td style="text-align:right;padding:.35rem"> ${ pairs. toLocaleString ()} </td></tr>
<tr><td style="padding:.35rem">Expected matching pairs (lambda)</td><td style="text-align:right;padding:.35rem"> ${ lambda. toPrecision (4 )} </td></tr>
<tr><td style="padding:.35rem">At least one duplicate</td><td style="text-align:right;padding:.35rem;font-weight:700"> ${ (probability * 100 ). toFixed (probability < 0.001 ? 5 : 2 )} %</td></tr>
<tr><td style="padding:.35rem">First whole n above 10% (reference)</td><td style="text-align:right;padding:.35rem"> ${ n10. toLocaleString ()} </td></tr>
<tr><td style="padding:.35rem">First whole n above 50% (reference)</td><td style="text-align:right;padding:.35rem"> ${ n50. toLocaleString ()} </td></tr>
</table>
<p style="margin:.7rem 0 0"><strong>Interpretation:</strong> these thresholds belong to the stated random-choice model. Your system still needs its own consequence, recovery, and acceptance target.</p>
</div>` ;
}
Before using the calculator, write down:
what value is chosen;
why choices are uniform and independent;
which devices share one collision domain;
what happens if two choices match.
Back to the chapter