Table of Contents

Class RandomExtensions

Namespace
MarymoorStudios.Core
Assembly
MarymoorStudios.Core.dll
public static class RandomExtensions
Inheritance
RandomExtensions
Inherited Members

Methods

NextBool(Random)

Returns a fairly distributed boolean.

public static bool NextBool(this Random rand)

Parameters

rand Random

Returns

bool

NextEnum<TEnum>(Random)

Returns a uniformly distributed value from chosen enum.

public static TEnum NextEnum<TEnum>(this Random rand) where TEnum : struct, Enum

Parameters

rand Random

Returns

TEnum

Type Parameters

TEnum

NextNormal(Random)

Generates two pseudo-random independent variables from a normal distribution.

public static (double Z0, double Z1) NextNormal(this Random rand)

Parameters

rand Random

Random source

Returns

(double Z0, double Z1)

A pair of independent variables.

NextNormal(Random, double, double)

Generates two pseudo-random independent variables from a normal distribution.

public static (double Z0, double Z1) NextNormal(this Random rand, double mean, double stddev)

Parameters

rand Random

Random source

mean double

mean of the distribution

stddev double

standard deviation

Returns

(double Z0, double Z1)

NextNormal(Random, TimeSpan, TimeSpan)

Generates two pseudo-random independent variables from a normal distribution.

public static (TimeSpan Z0, TimeSpan Z1) NextNormal(this Random rand, TimeSpan mean, TimeSpan stddev)

Parameters

rand Random

Random source

mean TimeSpan

mean of the distribution

stddev TimeSpan

standard deviation

Returns

(TimeSpan Z0, TimeSpan Z1)

NextUInt16(Random, ushort, ushort)

Returns a uniformly distributed (max-inclusive) 16-bit unsigned integer.

public static ushort NextUInt16(this Random rand, ushort min = 0, ushort max = 65535)

Parameters

rand Random
min ushort
max ushort

Returns

ushort

NextUInt32(Random, uint, uint)

Returns a uniformly distributed (max-inclusive) 32-bit unsigned integer.

public static uint NextUInt32(this Random rand, uint min = 0, uint max = 4294967295)

Parameters

rand Random
min uint
max uint

Returns

uint

NextUInt64(Random)

Returns a uniformly distributed 64-bit unsigned integer.

public static ulong NextUInt64(this Random rand)

Parameters

rand Random

Returns

ulong

NextUInt8(Random, byte, byte)

Returns a uniformly distributed (max-inclusive) 8-bit unsigned integer.

public static byte NextUInt8(this Random rand, byte min = 0, byte max = 255)

Parameters

rand Random
min byte
max byte

Returns

byte