Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Uniform Distribution (Discrete)

Definition

The discrete uniform pdf is

y=f(x|N)=1NI(1,...,N)(x)

Background

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

Examples

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);
figure;
stairs(x,y)
h = gca;
h.XLim = [0 11];

Generate Discrete Uniform Random Numbers

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

See Also

| | | | |

Related Topics

Was this topic helpful?