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.
Syntax
public static IDistribution<TResult> SelectMany<TSource, TResult>(this IDistribution<TSource> distribution, Func<TSource, IDistribution<TResult>> selector)
When using
TrySample
on the result, if the
distribution fails then the
selector is not applied.
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, IDistribution<TResult>>| The projection to be applied to values from the distribution. | | |
Return Value