GenerateRandomSearch

Random Shift Assignment Generator

Assigns people to shifts where each shift needs a particular number of staff, and lets you record who cannot work a given shift and who has to. If the numbers or the rules do not work, the tool says so before you publish anything.

What this generator does

Treats each shift's number as a ceiling that is never passed, and names any shift left under it. The rota generator rotates people through duties over weeks; this fills a set of shifts once, respecting how many each needs and who cannot be on which.

How to use this tool

  1. Enter the staff, one per line.
  2. Enter the shifts, one per line, with how many people each needs after a colon.
  3. Add rules for anyone unavailable for a shift or required on one.
  4. Press Assign shifts and check the status line.

Understanding the controls

Staff
One name per line. The page says before you assign whether there are more places than staff, and afterwards names the shifts left short and by how many.
Shifts
One per line with the number needed after a colon — "Saturday morning: 3". A shift is never given more than that number. With too few staff one can come out under it, and the page then names the shifts left short rather than calling the rota complete.
Must be / must not be
Use must not be for unavailability, which is the common case in a rota. Use must be where somebody has to be on a particular shift — a keyholder, or the only trained first-aider.
Spread numbers evenly
Levels how many people each shift gets, within the numbers given. It matters when there are fewer staff than places: with it on, the gap is spread across the shifts rather than landing on one. With it off, each person is drawn onto any shift with room.

Worked examples

Six staff, three shifts of two
Everyone works once, and every shift is fully covered.
With unavailability
A must-not-be rule for Tuesday means that person is never assigned Tuesday, whatever else changes.
Not enough staff
Five people for shifts needing seven are all assigned, and the page names the shifts left short and says that two places are unfilled.

Common use cases

  • Splitting weekend cover where each day needs a set number on
  • Volunteer rotas for an event with different staffing per session
  • Assigning cover when several people are unavailable on particular days
  • Filling shifts where one person has to be on each because of a qualification
  • Any rota where the numbers per shift are fixed rather than flexible

How this generator works

Required assignments are placed first and checked against the unavailability rules and the staffing numbers. The rest are filled by backtracking search, starting with whoever has fewest shifts available to them — that is where an over-constrained rota fails soonest, so the search finds out quickly rather than after a great deal of work. If no arrangement satisfies every rule, the result says so and names what could not be honoured.

Randomness and fairness

Randomness only decides between shifts a person is genuinely free to work, with ties broken at random rather than by list order. Everything the rules constrain is decided by the rules. A seed switches to a deterministic, non-cryptographic generator so a published rota can be reproduced exactly.

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

Limitations and good to know

  • Working-time rules, rest periods between shifts, contracted hours and individual availability beyond what you enter are all outside what this tool knows. The shift rota generator does take a rest gap and days off as rules, though it knows no more about the law than this does. Treat the output of either as a first draft for a human to check.
  • It fills one set of shifts, not a repeating rota. Fairness across weeks has to be managed by re-running it, or by using the duty rota generator, which rotates by design.
  • Every person is treated as equally able to work every shift unless barred. Skills, seniority and supervision requirements are not modelled.
  • Randomised assignment is inappropriate where the right person genuinely matters — safety-critical cover in particular should not be drawn at random.

Privacy and your data

Staff names and shifts are matched in the browser and never transmitted. Nothing is retained, so this holds no record of who was assigned what.