Class GLRandom
- Namespace
- Gamelogic.Extensions
- Assembly
- Assembly-CSharp.dll
Some convenience functions for random bools and integers.
[Version(1, 2, 0)]
public static class GLRandom
- Inheritance
-
GLRandom
- Inherited Members
Fields
GlobalRandom
Globally accessible Random object for random calls
public static readonly IRandom GlobalRandom
Field Value
Methods
Bool(float)
Generates a random bool, true with the given probability.
public static bool Bool(float probability)
Parameters
probability
float
Returns
GetRandom()
Gets a new random generator.
public static IRandom GetRandom()
Returns
- IRandom
A new random generator
GetRandom(int)
Gets a new random generator.
public static IRandom GetRandom(int seed)
Parameters
seed
intThe seed to instantiate the generator with.
Returns
- IRandom
A seeded instance of a random generator.
RandomOffset(float, float)
Gives a random value within a given range centered around a given value.
public static float RandomOffset(float value, float range)
Parameters
value
floatThe value around which the random values will be centered.
range
floatThe range of the returned value.
Returns
- float
A random value between value - range/2 and value + range/2.
Range(int)
Generates a Random integer between 0 inclusive and the given max, exclusive.
public static int Range(int max)
Parameters
max
int
Returns
Range(int, int)
Generates a Random integer between the given min inclusive and the given max, exclusive.
public static int Range(int min, int max)
Parameters
Returns
Range(float)
Generates a Random float between 0.0f inclusive and the given max
public static float Range(float max)
Parameters
max
float
Returns
Range(float, float)
Generates a Random float between the given min inclusive and the given max, exclusive.
public static float Range(float min, float max)
Parameters
Returns
Sign()
Generates either -1.0f or 1.0f randomly.
public static float Sign()