...

/

Empty Distribution

Empty Distribution

In this lesson, we will implement the empty distribution.

Previously, we mentioned that we will be needing the empty distribution.

Implementing the Empty Distribution

In this lesson, we will be implementing the Empty Distribution.

public sealed class Empty<T> : IDiscreteDistribution<T>
{
  public static readonly Empty<T> Distribution = new Empty<T>();
  private Empty() { }
  public T Sample() => throw new Exception(“Cannot sample from empty distribution”);
  public IEnumerable<T> Support() => Enumerable.Empty<T>();
  public int Weight(T t) => 0;
}

Now that we have this, we can fix up our other distributions to use it. The ...