C# Class LeopotamGroup.Math.Rng

Rng generator, mersenne twister based.
Show file Open project: Leopotam/LeopotamGroupLibraryUnity

Public Methods

Method Description
GetFloat ( bool includeOne = true ) : float

Get float random number from range [0, 1) or [0, 1] for includeOne=true.

GetFloat ( float min, float max, bool includeMax = true ) : float

Get float random number from range [min, max) or [min, max] for includeMax=true.

GetFloatStatic ( bool includeOne = true ) : float

Get float random number from range [0, 1) or [0, 1] for includeOne=true from singleton rng.

GetFloatStatic ( float min, float max, bool includeMax = true ) : float

Get float random number from range [min, max) or [min, max] for includeMax=true from singleton rng.

GetInt32 ( int max ) : int

Get int32 random number from range [0, max).

GetInt32 ( int min, int max ) : int

Get int32 random number from range [min, max).

GetInt32Static ( int n ) : int

Get int32 random number from range [0, n) from singleton rng.

GetInt32Static ( int min, int max ) : int

Get int32 random number from range [min, max) from singleton rng.

Rng ( ) : UnityEngine

Default initialization.

Rng ( long seed ) : UnityEngine

Initialization with custom seed.

SetSeed ( long seed ) : void

Set new seed.

SetSeedStatic ( long seed ) : void

Set new seed for singleton rng.

Private Methods

Method Description
GetRandomUInt32 ( ) : ulong

Method Details

GetFloat() public method

Get float random number from range [0, 1) or [0, 1] for includeOne=true.
public GetFloat ( bool includeOne = true ) : float
includeOne bool Include 1 value for searching.
return float

GetFloat() public method

Get float random number from range [min, max) or [min, max] for includeMax=true.
public GetFloat ( float min, float max, bool includeMax = true ) : float
min float Min value.
max float Max value.
includeMax bool Include max value for searching.
return float

GetFloatStatic() public static method

Get float random number from range [0, 1) or [0, 1] for includeOne=true from singleton rng.
public static GetFloatStatic ( bool includeOne = true ) : float
includeOne bool Include 1 value for searching.
return float

GetFloatStatic() public static method

Get float random number from range [min, max) or [min, max] for includeMax=true from singleton rng.
public static GetFloatStatic ( float min, float max, bool includeMax = true ) : float
min float Min value.
max float Max value.
includeMax bool Include max value for searching.
return float

GetInt32() public method

Get int32 random number from range [0, max).
public GetInt32 ( int max ) : int
max int Max value (excluded).
return int

GetInt32() public method

Get int32 random number from range [min, max).
public GetInt32 ( int min, int max ) : int
min int Min value.
max int Max value (excluded).
return int

GetInt32Static() public static method

Get int32 random number from range [0, n) from singleton rng.
public static GetInt32Static ( int n ) : int
n int .
return int

GetInt32Static() public static method

Get int32 random number from range [min, max) from singleton rng.
public static GetInt32Static ( int min, int max ) : int
min int Min value.
max int Max value (excluded).
return int

Rng() public method

Default initialization.
public Rng ( ) : UnityEngine
return UnityEngine

Rng() public method

Initialization with custom seed.
public Rng ( long seed ) : UnityEngine
seed long Seed.
return UnityEngine

SetSeed() public method

Set new seed.
public SetSeed ( long seed ) : void
seed long Seed.
return void

SetSeedStatic() public static method

Set new seed for singleton rng.
public static SetSeedStatic ( long seed ) : void
seed long Seed.
return void