Struct RandomSeed
- Namespace
- Stride.Core.Mathematics
- Assembly
- Stride.Core.Mathematics.dll
The RandomSeed is a structure for deterministically acquiring random values. One RandomSeed should be able to reproduce the same pseudo-random value for a fixed offset, but provide enough random distribution for different offsets or different random seeds Although other methods exist, the current implementation can easily be replicated in the shaders if required
public struct RandomSeed
- Inherited Members
Constructors
RandomSeed(uint)
Initializes a new instance of the RandomSeed struct from a target uint.
public RandomSeed(uint seed)
Parameters
seed
uintThe seed value to initialize the deterministic random generator.
Methods
GetDouble(uint)
Get a deterministic double value between 0 and 1 based on the seed
public double GetDouble(uint offset)
Parameters
offset
uint
Returns
- double
Deterministic pseudo-random value between 0 and 1
GetFloat(uint)
Get a deterministic float value between 0 and 1 based on the seed The calculations are still made as doubles to prevent underflow errors.
public float GetFloat(uint offset)
Parameters
offset
uint
Returns
- float
Deterministic pseudo-random value between 0 and 1