Class RandomStream
Very basic pseudo numbers generator.
Inheritance
Assembly: FlaxEngine.dll
File: Engine/Core/RandomStream.h
Syntax
public class RandomStream
Constructors
RandomStream()
Init
Declaration
public RandomStream()
RandomStream(int32 seed)
Creates and initializes a new random stream from the specified seed value.
Declaration
public RandomStream(int32 seed)
Parameters
int32
seed
The seed value. |
Methods
GenerateNewSeed()
Generates a new random seed.
Declaration
public void GenerateNewSeed()
GetBool()
Returns a random boolean.
Declaration
public bool GetBool() const
Returns
bool
|
GetCurrentSeed()
Gets the current seed.
Declaration
public int32 GetCurrentSeed() const
Returns
int32
|
GetFraction()
Returns a random number between 0 and 1.
Declaration
public float GetFraction() const
Returns
float
|
GetInitialSeed()
Gets initial seed value
Declaration
public int32 GetInitialSeed() const
Returns
int32
|
GetUnitVector()
Returns a random vector of unit size.
Declaration
public Float3 GetUnitVector() const
Returns
Float3
|
GetUnsignedInt()
Returns a random number between 0 and MAX_uint32.
Declaration
public uint32 GetUnsignedInt() const
Returns
uint32
|
GetVector3()
Gets a random Vector3 with components in a range between [0;1].
Declaration
public Vector3 GetVector3() const
Returns
Vector3
|
Initialize(int32 seed)
Initializes this random stream with the specified seed value.
Declaration
public void Initialize(int32 seed)
Parameters
int32
seed
The seed value. |
MutateSeed()
Mutates the current seed into the next seed.
Declaration
protected void MutateSeed() const
Rand()
Returns a random number between 0 and 1.
Declaration
public float Rand() const
Returns
float
|
RandHelper(int32 a)
Helper function for rand implementations.
Declaration
public int32 RandHelper(int32 a) const
Parameters
int32
a
Top border |
Returns
int32
A random number in [0..A) |
RandRange(float min, float max)
Helper function for rand implementations
Declaration
public float RandRange(float min, float max) const
Parameters
float
min
Minimum value |
float
max
Maximum value |
Returns
float
A random number in [min; max] range |
RandRange(int32 min, int32 max)
Helper function for rand implementations
Declaration
public int32 RandRange(int32 min, int32 max) const
Parameters
int32
min
Minimum value |
int32
max
Maximum value |
Returns
int32
A random number in [min; max] range |
Reset()
Resets this random stream to the initial seed value.
Declaration
public void Reset() const