Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Answer
68 34 62 51 94
Items generated 5
Population size 100

What is the Random Number and Letter Set Generator?

This tool produces a set of one or more randomly chosen items from a range you define. The range can be numeric (such as 1-100) or alphabetic (such as a-j). It is handy for sampling, drawing lots, creating PINs, picking quiz questions, assigning teams, or any task that needs unbiased random selection from a known set.

How to use it

Enter the Sample Size (how many items you want), then the Sample Range in the form START-END. Choose whether to Allow Duplicates (sampling with replacement) and whether to Print Commas between items. Press calculate to get a freshly drawn set in random order.

If both ends of the range are whole numbers it works in numeric mode; if both are single letters it works in letter mode, preserving the case of the first letter.

The formula and algorithm

The candidate population is every value in the inclusive range: for numbers, all integers from low to high, giving \(\text{high} - \text{low} + 1\) values; for letters, every character code from the lower to the higher code. Each item is picked uniformly with \(\text{index} = \lfloor \text{random} \times \text{remaining} \rfloor\). Without duplicates the population is shuffled (Fisher-Yates) and the first N items are taken, so every result is distinct. With duplicates each pick is independent and repeats can occur.

$$\text{Draw} = \text{Sample Size} \ \text{items from a population of size } N$$ $$\text{where}\quad \left\{ \begin{aligned} N &= |\,\text{high} - \text{low}\,| + 1 \\ [\text{low},\text{high}] &= \text{Sample Range} \end{aligned} \right.$$

Advertisement
Flat diagram contrasting sampling with duplicates allowed versus without duplicates
With duplicates the picked item stays in the pool; without duplicates it is removed.
Flat diagram showing random index selection from a pool of items into an output set
Each draw multiplies a random fraction by the remaining count to pick an index from the pool.

Worked example

Sample Size 5, Range 1-100, duplicates No, commas No. The population is the integers 1 through 100 (\(N = |100 - 1| + 1 = 100\) values). Five distinct uniform draws might give: 48 50 62 18 10. With commas on, the same draw reads 48, 50, 62, 18, 10.

FAQ

What if I ask for more items than the range holds? When duplicates are off, the number of results is limited by the range. Asking for 12 distinct digits from 0-9 returns only 10 items.

Are the results sorted? No. Items appear in the random order they were drawn.

How do I make a 4-digit PIN? Use Sample Size 4, Range 0-9, duplicates No for four distinct digits, or duplicates Yes to allow repeated digits.

Last updated: