Table of Contents

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

IRandom

Methods

Bool(float)

Generates a random bool, true with the given probability.

public static bool Bool(float probability)

Parameters

probability float

Returns

bool

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 int

The 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 float

The value around which the random values will be centered.

range float

The 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

int

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

min int
max int

Returns

int

Range(float)

Generates a Random float between 0.0f inclusive and the given max

public static float Range(float max)

Parameters

max float

Returns

float

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

min float
max float

Returns

float

Sign()

Generates either -1.0f or 1.0f randomly.

public static float Sign()

Returns

float