Newsvendor Problem Generator
You order once, demand arrives, and whatever you did not sell is nearly worthless. Order too few and you lose the margin on sales you could have made; order too many and you eat the cost of the leftovers. The balance between those two mistakes is the critical ratio, and it says something slightly counter-intuitive: the right quantity is a quantile of demand, not its average.
What this generator does
Builds a scenario with a unit cost, a selling price, a salvage value and several equally likely demand outcomes. It then computes the expected profit at every whole-number order quantity from zero up to the highest demand, and reports the one that maximises it — alongside the critical ratio the classical formula uses.
How to use this tool
- Generate a scenario with several equally likely demand outcomes.
- Guess the best order quantity before reading the answer.
- Compare it against the average demand — the two are usually different.
- Read the critical ratio to see which of the two mistakes is being avoided.
Understanding the controls
- How many demand outcomes
- Between 3 and 12, each equally likely. More outcomes make the demand distribution smoother and the answer less jumpy.
- Seed
- Any word reproduces the same costs and the same demand outcomes.
Common use cases
- Teaching the single-period stocking decision with an exhaustively checked answer
- Showing why average demand is the wrong quantity to order
- Event catering, print runs and perishable stock decisions
- Worked examples for an operations or revenue-management course
- Setting a reproducible exercise from a seed
How this generator works
Expected profit at a given quantity averages, over every demand outcome, the revenue from what sold plus the salvage on what did not, less the cost of everything ordered. Because the quantities are whole numbers and the outcomes are finite, every candidate can simply be evaluated — so the answer is found by exhaustive comparison rather than by rounding a formula, and the check confirms no other quantity beats it.
Randomness and fairness
The costs and demand outcomes are random; the best quantity is found by exhaustive evaluation. A seed reproduces the scenario exactly and is therefore explicitly not cryptographically secure. Without a seed the browser's cryptographically secure generator is used.
For how randomness is produced across the whole site, see how Generate Random works.
Limitations and good to know
- Demand outcomes are equally likely, which is simpler than a fitted distribution.
- One period only — no carrying stock forward, which is what makes this model tractable.
- Salvage value is always below cost, so leftovers always represent a loss.
- No fixed ordering cost is included; EOQ covers that trade-off instead.
- Nothing about a scenario survives a reload; the seed reproduces it.
Privacy and your data
The scenario and every evaluation run entirely in your browser. Nothing about the problem or your seed is transmitted or kept.
Related generators
- Economic Order Quantity CalculatorThe order quantity that minimises total inventory cost, shown with the cost either side so the minimum can be seen rather than taken on trust.
- Reorder Point CalculatorThe stock level at which to reorder, splitting lead-time demand from safety stock and showing why safety stock grows with the square root of lead time.
- Pricing Scenario GeneratorA table of prices either side of yours with the volume each would sell, showing where revenue peaks and where profit peaks — rarely the same place.
- Cash Flow Scenario GeneratorA month-by-month cash projection where the balance really is the running total, and the trough is called out because that is what needs funding.