Table of Contents

Class RandomExtensions

Namespace
Plugin.BaseTypeExtensions
Assembly
Plugin.BaseTypeExtensions.dll

Provides extension methods for the Random class.

public static class RandomExtensions
Inheritance
RandomExtensions
Inherited Members

Methods

NextBool(Random, int, int)

Returns true with a probability of chances out of outOf.

public static bool NextBool(this Random random, int chances, int outOf)

Parameters

random Random

The random number generator.

chances int

The number of chances for true.

outOf int

The total number of possible outcomes.

Returns

bool

True with the specified probability; otherwise, false.

NextByte(Random)

Returns a random byte value between 0 and 254.

public static byte NextByte(this Random random)

Parameters

random Random

The random number generator.

Returns

byte

A random byte value.

NextDouble(Random, double, double)

Returns a random double value between min (inclusive) and max (exclusive).

public static double NextDouble(this Random random, double min = 0, double max = 1)

Parameters

random Random

The random number generator.

min double

The inclusive lower bound.

max double

The exclusive upper bound.

Returns

double

A random double value in the specified range.