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
- frequenciesIEnumerable<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
- frequenciesIEnumerable<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. 
- seedint
- A seed to use for the random number generator. 
Returns
- IGenerator<int>
- A new generator.