xellstorm Learning center
EN
Open the app

Uniform distribution in Excel: random numbers between two values

Guide · Updated October 2026

In short: every value between a minimum and a maximum is equally likely, like a dice roll stretched over a range.

A uniform distribution makes every value between a minimum and a maximum equally likely. In Excel, =min + (max - min) * RAND() draws from it, and RANDBETWEEN(min, max) draws whole numbers. For a unit price between 40 and 60 (USD), the mean is 50, the P10 42 and the P90 58.

What a uniform distribution is

Two numbers define it: the lowest and the highest possible value. In between, the density is flat, so any stretch of the range gets a share of outcomes in proportion to its width: with a range of 20, each unit of it gets 5.0% of the outcomes, and the P10 lies a tenth of the way from the minimum.

How to read the chart: each bar counts how many of the 10,000 simulated values fell in that stretch, and the line is the theoretical curve. The taller the bar, the more often values land there. Here the bars are all about the same height: no part of the range is favoured.

Uniform distribution from 40 to 60A flat histogram of 10,000 draws of a unit price by xellstorm between 40 and 60, with the exact flat density as a line; nothing below 40 or above 60.405060P10 42P90 58
Unit price (USD), uniform from 40 to 60. Bars: 10,000 draws by xellstorm; line: the theoretical curve. Every stretch of the range of the same width gets the same share of the draws.
Formulas: mean, standard deviation, percentiles
Uniform formulas, worked for min 40 and max 60
QuantityFormula and example
Mean and median(min + max) / 2
= 50
Standard deviation(max − min) / √12
= 20 / 3.464 = 5.77
Percentile pmin + p × (max − min)
P10 = 42, P90 = 58

The uniform distribution in Excel

RAND() itself is uniform between 0 and 1. Stretching it onto any range gives a uniform draw: in one cell, =D9+(F9-D9)*RAND(), with the minimum in D9 and the maximum in F9. For whole numbers, RANDBETWEEN(min, max) returns an integer from min to max, both included.

Uniform distribution in Excel, row 9 of the workbook (min in D9, max in F9)
CellFormulaValue
Random number u (I9)=RAND()
Draw (J9)=D9+(F9-D9)*I9
Draw in one cell=D9+(F9-D9)*RAND()
Mean (K9)=(D9+F9)/250
P10 (L9)=D9+(F9-D9)*0.142
P90 (M9)=D9+(F9-D9)*0.958
Check the numbers: exact values against 10,000 draws from Excel and from xellstorm
Unit price, uniform: exact values and 10,000 draws each
ExactExcel, RAND()xellstorm
Mean50.0049.9650.00
Standard deviation5.775.785.77
P1042.0041.9742.00
P50 (median)50.0049.9150.00
P9058.0057.9558.00

Excel draws with RAND(), fully at random; xellstorm spreads its draws evenly over the range (Latin Hypercube sampling), so its statistics land closer to the exact values.

When a uniform distribution fits

Use it when you know a range and nothing more: no value inside it is more plausible than another. That is rarer than it seems. If you would bet on the middle rather than on the edges, a triangular or PERT distribution says so. On the same range from 40 to 60, a triangular peaked at 50 puts 75.0% of outcomes between 45 and 55; the uniform puts only 50.0% there, and its standard deviation is 5.77 against 4.08.

Entering a uniform distribution in xellstorm

  1. Make the cell an input and, on the Distributions step, choose Uniform; type its min and max. For whole numbers choose Integer uniform.
  2. With past values, “From data” in the side panel compares a uniform with other shapes, so you can see whether the data really are flat.

“Import from workbook” converts cells such as =a + (b - a)*RAND() into uniform inputs and RANDBETWEEN(a, b) into integer uniform ones, and add-in models convert from RiskUniform, VoseUniform and PsiUniform.

Questions

How do I generate a random number between two values in Excel?

Use =min + (max - min) * RAND(), for example =40 + (60 - 40) * RAND() for a value between 40 and 60. For whole numbers, use =RANDBETWEEN(40, 60). Both draw again whenever the sheet recalculates.

What are the mean and standard deviation of a uniform distribution?

The mean is the midpoint, (min + max) / 2, and the standard deviation is (max − min) / √12, about 0.29 times the width. From 40 to 60: mean 50, standard deviation 5.77.

Uniform or triangular?

Use uniform when no value in the range is more likely than another; use triangular, or PERT, when you have a most likely value. The uniform is the more spread-out choice for the same range: its standard deviation is 5.77 against 4.08 for a triangular peaked in the middle.

Related

xellstorm is a browser-based Monte Carlo simulation tool for Excel models: no add-in, and the workbook never leaves your computer.