ConceptsSecret and public randomness
Secret and public randomness
Why a beacon's bytes never make a secret on their own, how they still strengthen the generator, and what a public draw guarantees.
A beacon’s bytes are random, and they are also public: everyone who asks the beacon for a round gets the same ones. That makes them right for some jobs and wrong for others. This page explains which kind of randomness each job needs, why a pulse never makes a secret, how a pulse still helps the generator, and what a public draw guarantees.
Two kinds of randomness
Section titled “Two kinds of randomness”The library gives you two kinds of randomness, and each has its own type, so the compiler keeps them apart.
| Need | Use | Who can predict it |
|---|---|---|
| A secret: a key, token, salt or nonce | ISecureRandom |
Nobody |
| A draw others recompute | IVerifiableRandomFactory or VerifiableRandom.Create |
Everyone who reads the pulse |
A secret has to be unguessable, so it comes from the generator, which rests on the operating system’s entropy. A draw has to be checkable, so it comes from a pulse that everyone can read and recompute from.
A pulse never makes a secret
Section titled “A pulse never makes a secret”Everyone who reads the beacon sees the same bytes. A key, token or salt derived from a pulse is therefore known to everyone who reads that pulse, whatever algorithm turns the bytes into the secret. The library never serves a beacon’s bytes as a secret, and code that needs a secret depends on ISecureRandom, never on a pulse’s bytes. ADR-1000 records the rule.
How a pulse still helps
Section titled “How a pulse still helps”The generator draws its entropy from the operating system and uses each verified pulse only as additional input to its reseed. Its output is therefore at least as unpredictable as the operating system’s generator, whatever a beacon publishes. A forged, replayed or missing pulse cannot weaken it, because the pulse adds to the seed and never replaces any of it.
What a pulse adds is diversity. If the operating system’s generator were weak or cloned, such as a restored virtual machine snapshot that replays its state, the pulses that arrive afterwards differ, so the clones diverge. A beacon outage only stops that diversification: generation never stops. The generator page shows how the mixing works.
What a draw guarantees
Section titled “What a draw guarantees”A draw is the other direction: it uses a pulse’s bytes openly, so that anyone can check the result. VerifiableRandom.Create derives a byte stream named ncode-randomness-draw/1 from the pulse and your context, and every typed value is read from that stream by a specified algorithm. The algorithm is versioned, so a change to any part of it is a new name, never an edit of /1, and anyone can recompute your result from the pulse, the context and the algorithm’s specification. ADR-1004 records the contract.
A draw is an IRandomSource, never an ISecureRandom, so the compiler refuses to pass one where a secret is required.
ISecureRandom secrets = SystemRandomSource.Instance;using var draw = VerifiableRandom.Create(pulse, "example-raffle-2026-11-25");// A draw is an IRandomSource, never an ISecureRandom.IRandomSource values = draw;
var secretRoll = secrets.NextInteger(1, 7); // nobody can predict itvar drawRoll = values.NextInteger(1, 7); // anyone can recompute itBoth rolls are between 1 and 6, but only the first is a secret. Anyone with the pulse and the context can recompute the second.
Next steps
Section titled “Next steps”How the generator works explains the buffering and reseeding behind ISecureRandom. Run a public draw shows how to publish a result others can check, and Make a secret shows how to generate keys, tokens and salts.