GenerateRandomSearch

Secretary Problem Calculator

You interview candidates one at a time, must decide on the spot, and cannot go back. The best strategy is to see a fixed number, hire nobody from that group, and then take the first person who beats everyone you have seen. Look at about 37% and you land on the actual best candidate about 37% of the time — and, remarkably, that figure barely changes whether there are ten candidates or five hundred.

What this generator does

Works out, for every possible number of candidates to look at first, how often the strategy ends with the very best candidate, and picks the number that does best.

How to use this tool

  1. Set how many candidates you expect to see.
  2. Read the number to look at before starting to choose.
  3. Compare it against simply taking the first, which is what impatience amounts to.
  4. Scan the table to see how flat the curve is near the top — being a little off costs very little.

Understanding the controls

How many candidates
Between 2 and 500. Up to eight, every possible ordering is worked through rather than calculated, so the figures are counted.

Common use cases

  • Deciding how many flats or houses to view before making an offer
  • Setting a sensible number of candidates to interview before hiring
  • Working out when to stop comparing quotes
  • Teaching optimal stopping with a result students can check
  • Settling an argument about whether looking longer always helps

How this generator works

Up to eight candidates, every ordering is played out and the wins counted — 40,320 of them at eight. That count is then compared against the formula, which is what makes the formula trustworthy for the larger numbers where enumeration is out of reach. The cutoff shown is also confirmed to beat every other cutoff rather than merely to look right.

Randomness and fairness

Nothing is random. The same number of candidates always gives the same answer, because every ordering is treated as equally likely rather than sampled.

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

Limitations and good to know

  • It assumes you can only rank candidates against each other, not score them. If you can tell a good one absolutely, better strategies exist.
  • It assumes candidates arrive in a random order and that a rejected one is gone for good.
  • It optimises for landing on the very best. If second best would do, a different cutoff is better.
  • You must know roughly how many candidates there will be.

Privacy and your data

The calculation runs in your browser. Nothing you enter is transmitted or stored.