...

/

Introduction to Continuous Probability Distributions

Introduction to Continuous Probability Distributions

In this lesson, we give an introduction to continuous probability distribution.

In the previous lesson, we described our first attempt of fixing System.Random:

  • Make every method static and thread-safe
  • Draw a clear distinction between crypto-strength and pseudo-random methods

Continuous Probability Distribution

Let’s start by taking a step back and asking what we want when we’re calling NextInt or NextDouble or whatever on a source of randomness. What we’re saying is: we have a source of random Ts for some type T, and the values produced will correspond to some probability distribution. We can express that very clearly in the C# type system:

public interface IDistribution<T>
{
  T Sample();
}

In this lesson, we are going to look at continuous probability distributions, which we will represent as IDistribution<double>. We’ll look at integer distributions and other possible values for type parameter T in the upcoming lessons.

Now that we have an interface, what’s the simplest possible implementation? We have a library that produces a uniform distribution of doubles over the interval [0.0,1.0)[0.0, 1.0), which is called the standard continuous uniform distribution.

Here, the notation [x,y ...