Documentation Center

  • Trial Software
  • Product Updates

Uniform Distribution (Discrete)


The discrete uniform pdf is


The discrete uniform distribution is a simple distribution that puts equal weight on the integers from one to N.


Plot a Discrete Uniform Distribution cdf

As for all discrete distributions, the cdf is a step function. The plot shows the discrete uniform cdf for N = 10.

x = 0:10;
y = unidcdf(x,10);
set(gca,'Xlim',[0 11])

Generate Discrete Uniform Random Numbers

This example shows how to generate random numbers from a discrete uniform distribution.

Pick a random sample of 10 from a list of 553 items.

rng('default');  % For reproducibility
numbers = unidrnd(553,1,10)
numbers =

   451   501    71   506   350    54   155   303   530   534

Was this topic helpful?