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
randomRandomThe random number generator.
chancesintThe number of chances for true.
outOfintThe 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
randomRandomThe 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
randomRandomThe random number generator.
mindoubleThe inclusive lower bound.
maxdoubleThe exclusive upper bound.
Returns
- double
A random double value in the specified range.