Singleton<T> Class
A distribution containing a single value.
Namespace
RandN.Distributions
Interfaces
Base Types
  • object

Singleton<T>

object

IPortableDistribution<T>

IDistribution<T>

Syntax

public sealed class Singleton<T> : IPortableDistribution<T>, IDistribution<T>

Type Parameters

NameDescription
TThe type of the value.

Methods

NameReturn ValueSummary
Sample<TRng>(TRng)T
Samples a value from rng, blocking until a suitable value is returned.
TrySample<TRng>(TRng, T)bool
Attempts to sample a value from rng once, returning false if the value returned is not suitable. If is returned, the value of result is unspecified.

Extension Methods

NameValueSummary
Select<T, TResult>(Func<T, TResult>)IDistribution<TResult>
Transforms a distribution by mapping its values using the selector provided. This method implements the "map" operator from functional programming principles.
SelectMany<T, TIntermediate, TResult>(Func<T, IDistribution<TIntermediate>>, Func<T, TIntermediate, TResult>)IDistribution<TResult>
Transforms a distribution by mapping values using the selector provided to produce a new distribution, which is then sampled from.
SelectMany<T, TResult>(Func<T, IDistribution<TResult>>)IDistribution<TResult>
Transforms a distribution by mapping values using the selector provided to produce a new distribution, which is then sampled from. This method implements the "bind" operator from functional programming principles.