The Yes or No Generator produces a random Yes or No by drawing one Uint32 integer from the browser's Web Crypto API and mapping even values to Yes and odd values to No, giving each answer exactly 2^31 of the 2^32 possible source values. Because two divides the 2^32 source range evenly, every valid Uint32 from the browser's cryptographically secure generator is usable and no rejection sampling is required for ordinary binary use. The question, the answer, and a newest-first history of up to 20 entries all stay inside the current browser tab and never travel to a server, an account, or a remote service. That combination — a single unbiased integer per click, a deliberately finite mapping that can be described on the page, and a clearly local data flow — is what separates this tool from a die, a spinner, or a generic helper built on a weaker random source. The rest of this article walks through exactly how the mapping is built, how to use the Yes or No Generator, and where the line between a casual prompt and a serious decision should stay.

How a 50/50 Yes or No Generator Works
At the center of the tool is a primitive called Crypto.getRandomValues. The page fills a one-element Uint32Array with that call, which the W3C Web Cryptography specification defines as drawing a uniformly distributed integer from the inclusive range 0 through 4,294,967,295. Each click asks Web Crypto for one fresh integer; nothing else on the page — not the question, not the history, not the previous answer, not the current time — has any influence on which integer comes back. That isolation is the entire point of using a cryptographic source: a clean draw per prompt, every prompt.
Once the integer is in hand, the tool applies a small mapping. For two outcomes, the tool calculates the largest multiple of the outcome count that does not exceed the 2^32 source range, accepts values below that limit, rejects values at or above it, and then maps accepted values with modulo. Rejection sampling prevents the lower indexes from receiving an extra share of source values when the range does not divide evenly. For Yes and No specifically, 2 divides 2^32 exactly, so the acceptance limit is the whole Uint32 range and no valid value is ever rejected. Even values map to Yes and odd values map to No, giving each outcome exactly 2^31 source values. The mapping function is implemented as a general N-outcome mapper and is verified at a three-outcome boundary in deterministic tests; that boundary exercise is what proves the rejection path works even though it never fires during ordinary Yes or No use.
The tool also caps the number of redraws at 128. That bound exists because the mapping accepts or rejects a drawn Uint32 in a loop; in normal use a fresh accept arrives immediately, but the bound prevents a broken injected source or a malfunctioning platform implementation from hanging the page forever. Web Crypto implementations are browser-supplied, and the tool deliberately does not claim access to physical true randomness or expose the underlying generator algorithm. It uses what the browser hands back, the W3C Web Cryptography API defines how it should be filled, and MDN documents the behavior independently. The mapping is the part this tool owns and proves in tests; the random source is the part it borrows with full credit.
Generate a Yes or No in Your Browser
- Type a low-stakes question into the optional question field, or leave the field empty. The tool accepts up to 1,000 UTF-16 code units; the exact boundary is accepted and one code unit beyond it fails without truncation. Empty text is valid because a question is optional.
- Select the Generate Yes or No button. The tool calls Web Crypto for one Uint32, applies the mapping, and displays the current answer prominently above the history.
- Read the result. If Web Crypto is missing, blocked, or throws, the tool reports a clear failure and produces no answer; it deliberately does not fall back to Math.random.
- Scan the newest-first history list if you want to compare recent answers. The list holds at most 20 entries; after the twenty-first generation, the oldest entry is removed and the discarded count updates.
- Clear the history when you are finished if you want a fresh slate. Clearing resets both the visible entries and the discarded count, and it removes the current answer.
What the Optional Question and History Actually Do
The question field is a label, not a variable. Its only role is to remind you, when you look back at the history, which prompt a given answer was tied to. Editing a question clears the prominently displayed current answer and any prior error so an answer associated with older wording cannot be mislabeled; editing does not remove history. The question text is stored locally with the generated entry exactly as typed, and trimming is used only to decide whether the history should display the label "No question" when the field is blank or whitespace. Because the question never affects the random draw, two prompts with different wording but identical timing still receive independent Web Crypto draws and remain a fair 50/50.
The history is a bounded, newest-first UI list. It keeps at most 20 entries; the twenty-first generation removes the oldest. A cumulative message states exactly how many earlier answers have been discarded beyond the cap, so the limit is presented as a visible boundary rather than silent loss. Each entry carries a monotonically increasing local identifier that prevents duplicate runtime keys; that identifier is not random data and is not a persistent identifier — it exists only to keep rendering stable inside the tool. Because the history is descriptive only, it does not modify probability to compensate for streaks. Independent 50/50 results naturally form runs of the same answer, and a streak in the history has zero influence on the next draw.
Why the Tool Refuses to Fall Back to Math.random
If Web Crypto is missing, blocked, or throws, the tool reports a clear failure and produces no answer. That refusal is deliberate: the page describes its methodology out loud — "one Uint32 from Crypto.getRandomValues, even to Yes, odd to No" — and silently swapping in Math.random under the hood would contradict the displayed source and make a failure harder to detect. A reader who sees "Yes" should be able to trust that the value came from the documented mechanism, not from a hidden fallback they were never told about.
The mapping function supports a general finite outcome count. It calculates the largest multiple of the outcome count that does not exceed the 2^32 source range, accepts values below that limit, rejects values at or above it, and maps accepted values with modulo. Rejection sampling prevents the lower indexes from receiving an extra source value when the range does not divide evenly. For two outcomes, every Uint32 is accepted and the modulo step is straightforward. For three outcomes, the acceptance cutoff is not the full 2^32, so the tool loops up to 128 times until it finds an accepted value or fails explicitly. Deterministic tests inject specific Uint32 sequences — including the last accepted three-outcome value, the first rejected value followed by an accepted value, the exact 2^32 outcome-count boundary, and 128 rejected draws before exhaustion — to verify the rejection path. That injection seam exists only for tests; the user-facing UI always calls browser Web Crypto and never lets the question, history, time, or previous answer influence the next mapping.
The reference for the random source is the W3C Web Cryptography specification's definition of in-place integer typed-array filling, with MDN's Crypto.getRandomValues page documenting browser behavior independently. NIST SP 800-90A supplies the broader random-bit generator context that the W3C specification sits inside. None of those sources make a single Web Crypto draw appropriate for high-stakes decisions, but they do justify the refusal to downgrade the source silently.
Yes or No vs Coin Flip and Other Random Prompts
A binary prompt is one of several quick random generators people reach for. The Yes or No Generator is the right pick when the question itself is binary and the wording is what you want to remember alongside the answer. A coin flip is a faster mental model for heads-or-tails style choices, especially when you do not want a question field at all. A dice roller fits a wider outcome range — any number of sides from d4 to d20 or beyond — and is the better choice when you need a number rather than a word. A random name picker fits the case where the answer is actually one of several pre-listed options, not a binary Yes or No.
| Tool | Best fit | Source of randomness | Persistent label |
|---|---|---|---|
| Yes or No Generator | Binary prompts you want to remember the wording of | Web Crypto Uint32, mapped even/odd | Optional question stored with each entry |
| Coin Flip | Quick heads-or-tails without a question | No question field | |
| Dice Roller | Any-sided die, numeric outcome | Optional result list | |
| Random Name Picker | One winner from a written list | The list itself |
If you mostly need a number between, say, 1 and 100, a random number generator is closer to the job than any of these. If you need to draw a single date from a range, a random date generator fits that need. None of these tools learn preferences, weight alternatives, or guarantee alternating results, and streaks are expected in all of them.
When a Random Yes or No Is and Isn't Appropriate
A random Yes or No is appropriate when the question is casual, the consequences of either answer are similar, and either answer is acceptable. Settling a small debate, choosing between two similar restaurants for tonight, or picking which of two movies to start are good fits. The tool is also useful as a writing exercise prompt — give yourself a Yes or No to react to — or as a tiebreaker among friends who already agree to be bound by the result.
A random Yes or No is not appropriate when the decision is medical, legal, financial, safety-critical, emergency, security, consent, employment, eligibility, compliance-related, or otherwise high-stakes. The tool does not validate the available choices, does not understand consequences, does not weigh alternatives, and does not provide professional judgment. Web Crypto quality does not make the question appropriate. A mathematically balanced 50/50 answer can still be unsuitable, unlucky, or harmful when used outside a casual low-stakes context. The page is explicit about this limit; it is part of the product contract, not a marketing disclaimer appended at the bottom.
For a binary prompt where you want a clean 50/50 answer drawn from Web Crypto, an optional wording field that stays local, and a visible 20-entry history you can clear when you are done, the Yes or No Generator covers the case without asking you to upload your question or sign up. If your real need is a heads-or-tails flip with no question text, the Coin Flip tool is a leaner fit. If you need any-sided dice, the Dice Roller handles the wider numeric case. And if the answer is one of several named options rather than a binary word, a random name picker wheel is the more direct match.
Related reading: Generate a Yes or No Wheel Result Without a Spinner.