Table of Contents

Class WeightedRandomSelection

Namespace
WeightedRandoms
Assembly
WeightedRandoms.dll

The WeightedRandomSelection class provides a method for selecting an item from a list based on a weighted random selection algorithm. The weights are calculated based on a normal distribution with the peak at a specified percentage position in the range and with a specified height for the center that adjusts the shape of the curve. The width of the normal distribution can also be adjusted using a specified scaling factor.

public class WeightedRandomSelection
Inheritance
WeightedRandomSelection
Inherited Members

Methods

SelectItem<T>(List<T>, double, double, double)

public static T SelectItem<T>(List<T> items, double centerPercentage, double centerHeight, double scaleFactor)

Parameters

items List<T>
centerPercentage double
centerHeight double
scaleFactor double

Returns

T

Type Parameters

T