liveBook · Manning

Uniform distribution

As explained in Fabulous Adventures in Data Structures and Algorithms

A continuous uniform distribution assigns constant density across a continuous interval and zero density outside it.

A continuous uniform distribution assigns equal likelihood across a range of real numbers and zero weight outside it. The standard form spans 0.0 to 1.0; other forms use any minimum and maximum. section 15.2 section 15.6

Its probability density function is 1.0 between the bounds and 0.0 elsewhere in the implementation. Unlike a discrete distribution, its support cannot be enumerated, so the abstraction uses weighted doubles and sampling. section 15.2

Checking uniformity with a histogram

Take 100,000 samples, assign values between the histogram bounds to 40 columns, and render vertical bars. A roughly level plot provides an observable check that samples spread across the interval, while random variation explains small deviations.

The continuous form complements the discrete uniform distribution: Random.Next(max) selects equally weighted integers from 0 through max - 1, whereas the continuous form samples real-valued intervals. section 12.3 section 12.2

How Fabulous Adventures in Data Structures and Algorithms covers it

How deep it goes
Defines PDFs, interfaces, bounds, sampling, and histograms; defers normal-distribution implementation and more advanced sampling methods.
Examples
Uses C# Random, a standard 0.0-to-1.0 distribution, vertical histograms, and a discrete six-sided integer sampler.
What it assumes
Assumes familiarity with C# Random, doubles, interfaces, and sequences while introducing PDFs and continuous-distribution abstractions.
What you can do after
Build it from scratch as a C# distribution object, sample bounded doubles, and inspect their spread with a histogram.
How it connects
Connects probability density functions, random sampling, histograms, discrete distributions, and normal distributions.

Also explained in

Compare how 9 books explain uniform distribution →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fabulous Adventures in Data Structures and Algorithms. The section links point to the parts of the book it draws on.