Skip to content
Ali Ibrahim
← Blog

Safety stock is a distribution, not a number

The z · σ · √LT formula gives you one number. A simulation gives you the whole risk curve — and they disagree in ways that matter.

  • inventory
  • simulation
  • forecasting

The standard safety-stock formula is SS = z · σ_d · √LT. Pick a service level, look up z, multiply. It’s on the CPIM formula sheet and it’s in every textbook.

It’s also a model with assumptions baked in that rarely hold:

  • demand is normally distributed
  • lead time is fixed
  • demand and lead time are independent
  • one review period, one replenishment

Real replenishment breaks most of those. Lead time varies. Demand is often lumpy or skewed. A big order and a slow delivery tend to arrive together, not independently.

What a simulation shows that the formula hides

If you take the same inputs and instead simulate — draw thousands of random demand paths and variable lead times, run the actual reorder logic, count the stockouts — you don’t get a number. You get a distribution of outcomes: median fill rate, worst-case, the shape of the tail.

Often the formula’s “95% service level” turns out to be 91% once lead-time variability is in the model, because √LT quietly assumed lead time was a constant. Sometimes it’s the other way. The point is you can see the gap instead of trusting that the assumptions held.

Why this needs a server

Client-side JavaScript can do a lot, but tens of thousands of simulation runs with proper random sampling and statistical distributions is a job for numpy and scipy. That’s why the simulator on this site is a separate hosted Python app, not another browser widget — a deliberate contrast with the CPIM calculator, which is deterministic and belongs in the browser.

The formula is still the right first move — it’s fast and it’s close. The simulation is what you reach for when “close” isn’t good enough and you need to know how wrong it might be.