Skip to content
UniKit

Weighted menu picker

Picks what to eat from a weighted menu (one item per line, optionally 名称*权重). The draw uses a seeded pseudo-random stream, so the same seed and menu give the same answer, and it also returns a slot-machine style decelerating frame sequence plus each item weight share.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Menu (one item per line, optionally “name*weight”)

Eat this

Weighted random (xorshift32 with a seed) · reproducible for the same seed

Enter a menu to draw (one item per line, optionally “Noodles*2”)

What this tool does

  • Turn “what should I eat” into a weighted draw: one item per line, and “Noodles*2” doubles that item’s weight so it wins more often.
  • Reproducible and rerollable: the draw runs on a seeded xorshift32 stream, so the same menu with the same seed always returns the same item. Change the seed (or press ↻ next to it) to reroll without reloading.
  • Draw several items without replacement: ask for 2 and you get your first choice plus a fallback, ordered from the most to the least likely.
  • You also get a slot-machine style decelerating frame sequence (ending on the result) and each item’s weight share; the whole result is copyable.

Example

Input

面条*2
米饭
沙拉

Output

Today's pick: 面条
Weight share:
  面条: 50%
  米饭: 25%
  沙拉: 25%
Roll order: 沙拉 → 米饭 → 面条 → 沙拉 → 面条 → 面条 → 沙拉 → 米饭 → 面条
seed: 20260101

Real output for the default seed (20260101) and 8 frames: noodles carry weight 2 and the rest 1, so the 4 points of total weight become 50% / 25% / 25%; the rolling line has 9 frames — 8 candidates plus the final result.

Frequently asked questions

How are the weights used? Is the share the chance of being picked?

A weight is written after the dish name: “Noodles*2” means weight 2, omitted means 1, and only positive numbers are accepted. Share = weight ÷ total weight × 100% (two decimals), and that is the chance for the first pick. Multiple picks are drawn **without replacement**: each picked item has its weight temporarily set to zero, so the second pick’s share is redistributed over the remaining items — the first-round percentage is not the second item’s probability.

Why not Math.random?

For reproducibility. The draw uses a seeded xorshift32 pseudo-random stream (seed 20260101 by default), so the same menu with the same seed gives identical results in the browser, in unit tests and on someone else’s machine — the rolling frames reproduce frame by frame and tests can assert exact output. To get a different answer, change the seed; do not expect randomness from a single seed, that is precisely the point.

What is the rolling order? Does it animate?

The rolling line is the candidate sequence generated from the same seed, mimicking slot-machine frames, with the last frame pinned to the result (which is why the line has frames + 1 entries). The tool only produces text: it does not play an animation, so replay the sequence yourself if you want one. The frame count is adjustable (0–200); 0 leaves only the final frame.

Which menu syntax is supported?

One item per line, blank lines ignored; the weight separator may be * or ×, and a space form such as “Rice x3” also works. Because the separator is ambiguous, avoid * and × inside dish names: a line that has one but no positive number after it (“Rice*-1”, “Rice*abc”) fails loudly instead of being treated as a name. Counts are limited to 1–20 picks and cannot exceed the number of menu lines.

Does it consider nutrition, taste, or what I ate recently?

No. This is a pure drawing tool: the weights come entirely from you, it has no network access, keeps no history and has no idea what you ate yesterday, so it makes no “balanced” or “learned” decisions. Want something to appear more often? Give it a bigger weight.

Is my menu uploaded?

No. The draw and the rendering happen locally in the browser with no network requests and no storage writes; closing the page discards everything.

Keywords:Weighted menu pickereat-whatofflinedeterministic

Related tools