GenerateRandomSearch

Random Sample Generator

Picking a sample is easy; being able to show it was a fair one is the hard part. This draws without replacement, so nothing appears twice, and it reports how many different samples were possible — which is the figure that turns 'I picked some' into a statement anybody can check.

What this generator does

Draws a simple random sample from a list you supply, without replacement, so no item can be selected twice. Alongside the sample it shows exactly how many distinct samples of that size the list allows — the nCr figure — which is what makes the draw auditable rather than merely asserted. A seed makes the draw reproducible, so the same sample can be produced again from the same list and seed by anybody who has both.

How to use this tool

  1. Paste your list, one item per line.
  2. Set how many to draw.
  3. Optionally enter a seed so the same sample can be reproduced later.
  4. Press Draw, then copy or print the result with its sample count.

Understanding the controls

Your list
One item per line. Blank lines are ignored and duplicates are kept as-is, because two identical entries in a population are two chances of selection and removing them would silently change the sampling.
Sample size
How many to draw. It cannot exceed the list length, because drawing without replacement from a list of twenty cannot produce twenty-one items.
Seed
Leave it blank for a one-off draw using the browser's cryptographic generator. Enter a word and the draw becomes reproducible — the same list and seed always give the same sample, which is what lets a sample be re-derived by somebody checking it.

Worked examples

Ten from fifty
10,272,278,170 possible samples — a figure worth quoting in an audit note.
Three from ten
120 possible samples. Small enough that a sceptic could enumerate them.
Reproducible
The same list and the seed 'march-audit' always produce the same sample.
Everything
Drawing all n items is one possible sample — a shuffle, not a selection.

Common use cases

  • Selecting cases for a spot check or audit, with a defensible record of how
  • Choosing a subset of survey respondents to follow up
  • Picking test cases from a larger suite without bias towards the top of the file
  • Teaching sampling with the possible-sample count visible
  • Selecting winners from entries where nobody may win twice

How this generator works

A partial Fisher-Yates shuffle: for each of the first r positions, swap in an item chosen uniformly from those not yet taken. That gives every possible sample the same chance without shuffling the whole list, and without the subtle bias that filtering a shuffled list or drawing-and-rejecting can introduce. The count of possible samples is computed separately in exact integer arithmetic, so a list of fifty with a sample of ten reports its full 10,272,278,170 rather than a rounded approximation.

Randomness and fairness

Unseeded draws use the browser's cryptographic random number generator through a partial Fisher-Yates shuffle, which gives every sample of that size an equal chance. Entering a seed switches to a deterministic generator so the draw can be reproduced — that mode is deterministic, not cryptographic, which is the whole reason it can be checked afterwards, and it should never be used for anything where being predictable would matter.

For how randomness is produced across the whole site, see how Generate Random works.

Assumptions this tool makes

  • Each line is one member of the population and every member should have an equal chance of selection.
  • Sampling is without replacement, so an item selected once is removed from consideration.

Limitations and good to know

  • It draws a simple random sample. Stratified, clustered and weighted sampling are different designs and this does not perform them.
  • It cannot know whether your list is the right population. A fair draw from an incomplete list is still an unrepresentative sample.
  • Duplicated lines are treated as separate items, because in a population they usually are. De-duplicate first if that is not what you mean.
  • A seeded draw is reproducible and therefore predictable to anybody who knows the seed. That is exactly what makes it verifiable, and exactly why it must not be used where unpredictability matters.

Common mistakes

Sorting the list first and taking the top n
That is not a sample, it is a selection by whatever the sort was. Paste the list in whatever order it arrives and let the draw do the work.
Drawing repeatedly until the sample looks representative
That reintroduces exactly the bias sampling exists to remove. If you need the sample to reflect known subgroups, sample within each subgroup separately instead.
Using a seed for something that must be unpredictable
A seeded draw can be reproduced by anybody with the seed. Use seeds when you want a draw to be checkable, and leave the seed blank when you want it to be unguessable.

Practical tips

  • Record the seed and the list alongside the result. Those three together let anybody reproduce the draw, which is what makes it defensible months later.
  • Publish the seed before drawing rather than after. A seed chosen afterwards is a choice of outcome, and the two are indistinguishable once the draw has happened.
  • Quote the possible-sample count in your notes. It is a concrete statement about how much the draw could have varied.

Troubleshooting

The same items keep appearing
Check whether a seed is set — a seed reproduces the same draw every time by design. Clear it for an independent draw.
Fewer items came back than asked for
The sample cannot exceed the list. Blank lines are ignored, so a list with gaps holds fewer items than it appears to.

Privacy and your data

Your list is processed entirely in your browser. It is never uploaded, never stored, and never written into the page address. Analytics records only that a sample was drawn and how many items it contained — never the list itself or any item in it.

Frequently asked questions

What does 'without replacement' mean?
Once an item is drawn it cannot be drawn again, so a sample of five contains five distinct positions from your list. Sampling with replacement would allow the same item to appear twice, which is a different design and not what most people want when selecting cases.
Why show how many samples were possible?
Because it is the figure that makes the draw auditable. 'One of 10,272,278,170 possible samples, drawn with seed march-audit' is a statement somebody else can verify. 'I picked ten' is not.
Is my list uploaded anywhere?
No. Everything happens in your browser. The list is never transmitted, never stored, and never included in analytics or the page address.