Uniform distribution
Every value between a and b is equally likely. The chance of landing in a window is just the window's width as a share of the whole range.
01The formula
- the density: height of the curve at x
- the lowest and highest possible values
- the ends of the window you ask about, inside [a, b]
- the random value, such as the time an order arrives
02See it move
03Where it is used
- Quant researcherTurns uniform random numbers into any other distribution when building simulations.
- Execution traderRandomises order timing uniformly within a window so the pattern is hard for others to detect.
- Risk managerUses a uniform range as an honest 'no idea beyond the bounds' assumption in stress tests.
04Why traders use it
It is the starting point for simulation: every random number generator produces uniform draws first. It also shows the basic idea of a density: probability is area.
05Worked example
An order arrives at a random moment between 0.0 and 10.0 seconds. The chance it lands between 2.0 and 5.0 seconds is 30.0%. The density is 0.100, the mean 5.00 and the standard deviation 2.89.
06How it is built
- A flat density over must have total area 1, so its height is .
- The chance of a window is its area: width times height .
- By symmetry the mean is the midpoint .
- Integrating over the range gives the variance .
07The common mistake
Reading the density as a probability. When is less than 1 the density is above 1; only areas under it are probabilities.
08In Python and LaTeX
from scipy.stats import uniform a, b = 0, 10 X = uniform(loc=a, scale=b - a) print(X.cdf(5) - X.cdf(2), X.mean(), round(X.std(), 4))
f(x) = \frac{1}{b - a} \ \text{for } a \le x \le b, \qquad P(c < X < d) = \frac{d - c}{b - a}09Where it fits
Rather not code the maths yourself? Describe your trading idea and let AI build the bot.
Build a bot with AgenKitThe worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.