Main Content

Uniform Distribution (Continuous)

Evaluate and generate random samples from continuous uniform distribution

Statistics and Machine Learning Toolbox™ offers several ways to work with the uniform distribution.

  • Create a probability distribution object UniformDistribution by specifying parameter values. Then, use object functions to evaluate the distribution, generate random numbers, and so on.

  • Use distribution-specific functions with specified distribution parameters. The distribution-specific functions can accept parameters of multiple uniform distributions.

  • Use generic distribution functions (cdf, icdf, pdf, random) with a specified distribution name ('Uniform') and parameters.

To learn about the uniform distribution, see Uniform Distribution (Continuous).


UniformDistributionUniform probability distribution object


Probability Distribution FunctionInteractive density and distribution plots


expand all

Create UniformDistribution Object

makedistCreate probability distribution object

Work with UniformDistribution Object

cdfCumulative distribution function
icdfInverse cumulative distribution function
iqrInterquartile range
meanMean of probability distribution
medianMedian of probability distribution
pdfProbability density function
randomRandom numbers
stdStandard deviation of probability distribution
truncateTruncate probability distribution object
varVariance of probability distribution
randUniformly distributed random numbers
unifcdfContinuous uniform cumulative distribution function
unifpdfContinuous uniform probability density function
unifinvContinuous uniform inverse cumulative distribution function
unifitContinuous uniform parameter estimates
unifstatContinuous uniform mean and variance
unifrndContinuous uniform random numbers
mleMaximum likelihood estimates
disttoolInteractive density and distribution plots
qqplotQuantile-quantile plot
randtoolInteractive random number generation


Uniform Distribution (Continuous)

The uniform distribution (also called the rectangular distribution) is notable because it has a constant probability distribution function between its two bounding parameters.

Generate Random Numbers Using Uniform Distribution Inversion

This example shows how to generate random numbers using the uniform distribution inversion method.