Method FrequencyRandomInt
- Namespace
- Gamelogic.Extensions.Algorithms
- Assembly
- Gamelogic.Extensions.dll
FrequencyRandomInt(IEnumerable<float>)
Generates random integers at relative frequencies provided.
public static IGenerator<int> FrequencyRandomInt(IEnumerable<float> frequencies)
Parameters
frequencies
IEnumerable<float>The relative frequencies of each integer. If the array of frequencies has three elements, then the integers produced will be 0, 1, 2 (provided all frequencies are positive). All frequencies must be non-negative, and at least one must be positive.
Returns
- IGenerator<int>
A new generator.
FrequencyRandomInt(IEnumerable<float>, int)
Generates random integers at relative frequencies provided.
public static IGenerator<int> FrequencyRandomInt(IEnumerable<float> frequencies, int seed)
Parameters
frequencies
IEnumerable<float>The relative frequencies of each integer. If the array of frequencies has three elements, then the integers produced will be 0, 1, 2 (provided all frequencies are positive). All frequencies must be non-negative, and at least one must be positive.
seed
intA seed to use for the random number generator.
Returns
- IGenerator<int>
A new generator.