Settings

Draw it in SAMPLE, which uses a seeded generator, so the same population and the same seed always produce the same sample and anybody given the seed can reproduce it. It writes out a record naming the method, the population size, the seed and the generator. Nothing is uploaded.

The question that arrives later

You audit twenty files out of nine hundred. The twenty are clean. Somebody later asks how the twenty were chosen.

“Randomly” is not an answer, because it is unfalsifiable in both directions. It is exactly what somebody would say if they had chosen the twenty they knew were clean, and it is also exactly what somebody would say if they had genuinely used a random function. Nothing distinguishes the two, which means an honest auditor and a dishonest one produce identical evidence.

That is the problem a seed solves, and it solves it completely.

What a seed does

A pseudorandom generator produces a sequence that looks random but is entirely determined by a starting value — the seed. Same seed, same sequence, every time, on any machine, in any implementation of the same algorithm.

So a sample drawn from a seeded generator carries its own proof of method. Give somebody the population, the seed and the name of the generator, and they can reproduce your sample exactly. If they get the same twenty files, your account of how you chose them is confirmed. If they get different ones, it is not.

This turns the sample from an assertion into something checkable, which is the whole of what “defensible” means here.

Why a spreadsheet cannot do this

Spreadsheet random functions are deliberately unseedable. They reseed themselves from the system state, they recalculate whenever the sheet does, and there is no supported way to say “start from here.” That is a reasonable design for the common case and it makes them useless for this one.

The practical consequence is that a sample drawn in a spreadsheet cannot be reproduced by anybody, including the person who drew it, five minutes later. The evidence that the method was followed does not exist and never existed.

The workaround people reach for — pasting the random column as values so it stops changing — preserves the sample but not the method. It shows what was selected, not that it was selected by the process described.

Publish the seed

This is counter-intuitive and it is the point. A seed is not a password. Its value is precisely that somebody else can use it.

What matters is when it was fixed. A seed recorded in the file note before the draw, in a document with a date on it, establishes that the selection was determined before anybody saw which items were selected. A seed produced afterwards establishes nothing, because a seed can be searched: given enough attempts, somebody could find the seed that happens to select the twenty files they wanted.

So the order is the evidence:

  1. Decide the method and the sample size.
  2. Choose a seed and write it down, somewhere dated, before drawing.
  3. Draw.
  4. Record the population size, the method, the seed and the generator alongside the sample.

A memorable seed is better than a number for this, because it is more obviously a human decision recorded at a time: “quarterly file audit, October” reads like a note and a nine-digit number reads like output.

Not cryptographically secure, and it does not need to be

A generator like mulberry32 is small, published, and trivially predictable if you know the seed — which is the entire point. The requirement is reproducibility, not unpredictability.

The distinction matters because people sometimes reach for a cryptographic generator thinking it is the more rigorous choice. It is the wrong tool: cryptographic generators are designed to be unseedable and unpredictable, which destroys exactly the property you need. Reserve them for keys.

Drawing the sample properly

Given a seeded generator there is still a right and a wrong way to take n items from a population.

The wrong way, and the common one, is to pick n random positions and discard duplicates. It works, but the probability structure is slightly awkward and the number of generator calls depends on how many collisions occur, which makes the draw harder to reproduce in another implementation.

The right way is a full Fisher–Yates shuffle of the population followed by taking the first n. Every permutation is equally likely, the number of generator calls is fixed, and anybody implementing the same shuffle gets the same answer.

Systematic sampling, and its one trap

Systematic sampling takes every kth item from a random start. It is what inspection regimes usually want, because it spreads the sample evenly across the list — across dates, across sequence numbers, across the order things were filed — where a simple random sample can by chance cluster.

It has exactly one serious failure mode, and it is worth knowing: if the list has a repeating pattern with the same period as your step, the sample hits the same kind of item every time. Sample every seventh day and you sample the same weekday all year. Sample every twelfth record in a list ordered by month and you sample the same month.

The defence is to ask whether the order of the list means anything. If it does, either randomise the order first or use a different method.

Stratification, and what it is actually for

Stratified sampling takes a proportional share from each group rather than sampling the whole population at once. Its purpose is not precision in the abstract: it is to stop a small but important group being absent from the sample by luck.

If two per cent of your cases are a category you specifically want covered, a simple random sample of a hundred will contain none of them roughly thirteen times in a hundred. That is not a rare event. Stratifying guarantees representation and makes the sample defensible against the obvious question, which is whether you looked at any of the unusual ones.

The cost is that you have to decide the groups in advance, and that decision is part of the method and should be recorded with it.

What the record should say

Four things, and none of them is optional: the method, the population size, the seed, and the generator. With those, anybody can reproduce the draw. Without any one of them, they cannot, and the sample is back to being an assertion.

Related tools