Table of Contents

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 int

The exclusive upper bound of the random integer.

Returns

int

NextUniformRandomInt(int, int)

Generates a random integer in the range [minValue, maxValue).

public static int NextUniformRandomInt(int minValue, int maxValue)

Parameters

minValue int

The inclusive lower bound of the random integer.

maxValue int

The exclusive upper bound of the random integer.

Returns

int

UniformRandomDouble(double)

public static IEnumerable<double> UniformRandomDouble(double maxValue)

Parameters

maxValue double

Returns

IEnumerable<double>

UniformRandomDouble(double, double)

public static IEnumerable<double> UniformRandomDouble(double minValue, double maxValue)

Parameters

minValue double
maxValue double

Returns

IEnumerable<double>

UniformRandomInt(int)

Returns an infinite sequence of random integers in the range [0, maxValue).

public static IEnumerable<int> UniformRandomInt(int maxValue)

Parameters

maxValue int

The exclusive upper bound of the random integers.

Returns

IEnumerable<int>

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 int

The exclusive upper bound of the random integer.

count int

The number of random integers to generate.

Returns

IRandomAccessList<int>

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 int

The exclusive upper bound of the random integer.

count int

The number of random integers to generate.

Returns

IRandomAccessList<int>