Select<TSource, TResult>(IDistribution<TSource>, Func<TSource, TResult>) Method
Transforms a distribution by mapping its values using the selector provided. This method implements the "map" operator from functional programming principles.

Syntax

public static IDistribution<TResult> Select<TSource, TResult>(this IDistribution<TSource> distribution, Func<TSource, TResult> selector)

Examples

This method enables use of LINQ query syntax over IDistribution<TResult>. For example:
IDistribution<int> evenNumbersDistribution =
    from i in Uniform.NewInclusive(0, 5)
    select i * 2;

Type Parameters

NameDescription
TSourceThe generic type of the input distribution.
TResultThe generic type of the output distribution.

Parameters

NameTypeDescription
distributionIDistribution<TSource>The distribution to be transformed.
selectorFunc<TSource, TResult>The projection to be applied to values from the distribution.

Return Value

TypeDescription
IDistribution<TResult>