namespace UnityEngine.Perception.Randomization.Samplers
{
///
/// Encapsulates the random state that all samplers mutate when generating random values
///
public static class SamplerState
{
///
/// The central random state that all samplers mutate when generating random numbers
///
public static uint randomState = SamplerUtility.largePrime;
///
/// Creates a random number generator seeded with a unique random state
///
/// The seeded random number generator
public static Unity.Mathematics.Random CreateGenerator()
{
return new Unity.Mathematics.Random { state = NextRandomState() };
}
///
/// Generates a new random state and overwrites the old random state with the newly generated value
///
/// The newly generated random state
public static uint NextRandomState()
{
randomState = SamplerUtility.Hash32NonZero(randomState);
return randomState;
}
}
}