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
| Name | Description |
|---|
| TSource | The generic type of the input distribution. |
| TResult | The generic type of the output distribution. |
Parameters
| Name | Type | Description |
|---|
| distribution | IDistribution<TSource>| The distribution to be transformed. | | selector | Func<TSource, TResult>| The projection to be applied to values from the distribution. | | |
Return Value