Class Generator
- Namespace
- AlgorithmsSW
- Assembly
- AlgorithmsSW.dll
Provides methods for generating random values.
public static class Generator
- Inheritance
-
Generator
- Inherited Members
Methods
NextUniformRandomInt(int)
Generates a random integer in the range [0, maxValue).
public static int NextUniformRandomInt(int maxValue)
Parameters
maxValue
intThe exclusive upper bound of the random integer.
Returns
NextUniformRandomInt(int, int)
Generates a random integer in the range [minValue, maxValue).
public static int NextUniformRandomInt(int minValue, int maxValue)
Parameters
minValue
intThe inclusive lower bound of the random integer.
maxValue
intThe exclusive upper bound of the random integer.
Returns
UniformRandomDouble(double)
public static IEnumerable<double> UniformRandomDouble(double maxValue)
Parameters
maxValue
double
Returns
UniformRandomDouble(double, double)
public static IEnumerable<double> UniformRandomDouble(double minValue, double maxValue)
Parameters
Returns
UniformRandomInt(int)
Returns an infinite sequence of random integers in the range [0, maxValue).
public static IEnumerable<int> UniformRandomInt(int maxValue)
Parameters
maxValue
intThe exclusive upper bound of the random integers.
Returns
Remarks
Use Take<TSource>(IEnumerable<TSource>, int) to get a finite amount of elements.
UniqueUniformRandomInt_WithSet(int, int)
Generates a set of random integers in the range [0, maxValue) where each integer is unique.
public static IRandomAccessList<int> UniqueUniformRandomInt_WithSet(int maxValue, int count)
Parameters
maxValue
intThe exclusive upper bound of the random integer.
count
intThe number of random integers to generate.
Returns
UniqueUniformRandomInt_WithShuffledList(int, int)
Generates a set of random integers in the range [0, maxValue) where each integer is unique.
public static IRandomAccessList<int> UniqueUniformRandomInt_WithShuffledList(int maxValue, int count)
Parameters
maxValue
intThe exclusive upper bound of the random integer.
count
intThe number of random integers to generate.