Methodology
Web Crypto, rejection sampling, and what this is not.
const buf = new Uint32Array(1) crypto.getRandomValues(buf) // map to [min, max] inclusive without naive modulo bias (rejection sampling)
About this page
ChanceKit's tools draw integers with the browser's Web Crypto generator, then map those integers onto heads, faces, list indexes, or a numeric range. This page is the precise version of the fairness note linked from every tool.
The draw
The preferred call is crypto.getRandomValues on a one-element Uint32Array. That fills 32 bits from the platform's cryptographically strong pseudorandom generator. It is designed so the next output is not something a web page can predict from earlier outputs. It is still a deterministic algorithm inside the operating system, seeded from entropy the page cannot display. Calling it 'true random' would be false.
Mapping those bits onto a range with a remainder operator is slightly unfair when the range size does not divide 2^32. Lower remainders would occur once more than higher ones. ChanceKit uses rejection sampling: if the raw value falls in the leftover tail, it draws again. The values that remain map evenly onto the inclusive range. A coin is the range {0, 1}. A d20 is {1,…,20}. A wheel is {0,…,n−1}. A numeric page is {min,…,max}.
What the animation does
The result is fixed when you activate the control. The coin turn, the die shake, and the wheel rotation reveal that result. They do not draw a second time, and they do not take mouse speed into account. If you prefer reduced motion, the same result appears without the extra movement.
Compared with Math.random
Math.random is a common source and a poor one to leave undocumented. Engines have used generators that are fine for particles and unsuitable for anything an adversary might care about. ChanceKit does not use Math.random for outcomes. Web Crypto is the stronger default already sitting in the browser, and it does not require a network call.
Compared with atmospheric noise
random.org has offered a true-random service based on atmospheric noise since the 1990s. That is a different product with a different threat model and a public explanation of physical entropy. Use it, or a lab source you trust, when a method section needs that kind of randomness. ChanceKit does not proxy those feeds, does not claim their properties, and does not ask you to pretend a browser PRNG is a radio receiver.
Out of scope
Do not use these draws for lottery picks, gambling systems, sports betting, or cryptographic keys and seeds. The tools are entertainment and education. A strong PRNG in a web page is still a web page: extensions, shared computers, and screenshots exist. Generate secrets in a password manager or a dedicated tool, not in a spinner.
Related
Questions
Is the generator cryptographically strong?
The bytes come from crypto.getRandomValues, which the Web Crypto specification requires to be a cryptographically strong pseudorandom source. ChanceKit then maps them with rejection sampling. That is a statement about the API we call, not a third-party audit of your device, and not a claim that the page is a hardware RNG.
Can I reproduce a result from a seed?
Not in this version. There is no seed box and no share link that replays a draw. Reproducible streams are useful in simulations and easy to misuse as 'provably fair' gambling theater. If we add seeds later, they will be documented as optional and off by default.
Does the server see the outcome?
The draw runs in the page. ChanceKit does not operate an account system that stores flips. A hosting provider still sees ordinary web requests for the HTML and assets, the same as any site. The integer itself is computed after the page is in your browser.
Why can a short session look unbalanced?
Because fair draws clump. Three heads is 1 in 8. A missing 100 in twenty tries of 1–100 is normal. The tools do not insert corrective results to make a demo look tidy. If a lesson needs a large sample, generate more numbers and tally them.