Pick one option at random

Choose one non-empty option with equal probability or with an explicit positive weight for every row.

freeworks offlinenothing uploaded
ToolRandom Decision Maker
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Equal mode assigns every option one rejection-sampled integer index. Weighted mode scales a 32-bit fraction across the sum of the entered weights and walks their cumulative intervals, making each intended share equal to its weight divided by the total.

Formula
probability of option i = weight i ÷ sum of all weights
  • Equal likelihood applies only when the weight list is omitted, and at least two choices are required.
  • Blank seed uses Web Crypto; entered seed text makes branch selection repeatable for testing.

Worked example

Where to eat, one option weighted heavier
Weights are one per line, in the same order as the options
Input
											Options: ["Pizza","Sushi","Tacos"]
Weights: ["3","1","1"]
Seed: lunch-friday
										
Output
												Chosen: Pizza
Option count: 3
Method: weighted
											

When to use this

Lunch groups choose among restaurants, training plans weight exercises by desired frequency, and test harnesses replay one branch that exposed a failure.

Edge cases

  • Three weights cannot be paired with two non-empty options, so mismatched lists are rejected.
  • Zero, negative, non-numeric, or infinitely large weights cannot define finite positive intervals and stop processing.
  • Two identical option labels remain two separate rows and therefore receive the combined probability of both intervals.

References