Struct Random
Random Number Generator based on xorshift. Designed for minimal state (32bits) to be easily embeddable into components. Core functionality is integer multiplication free to improve vectorization on less capable SIMD instruction sets.
Inherited Members
Namespace: Unity.Mathematics
Assembly: solution.dll
Syntax
[Serializable]
public struct Random
Constructors
Name | Description |
---|---|
Random(uint) | Constructs a Random instance with a given seed value. The seed must be non-zero. |
Fields
Name | Description |
---|---|
state | The random number generator state. It should not be zero. |
Methods
Name | Description |
---|---|
CreateFromIndex(uint) | Constructs a Random instance with an index that gets hashed. The index must not be uint.MaxValue. |
InitState(uint) | Initialized the state of the Random instance with a given seed value. The seed must be non-zero. |
NextBool() | Returns a uniformly random bool value. |
NextBool2() | Returns a uniformly random bool2 value. |
NextBool3() | Returns a uniformly random bool3 value. |
NextBool4() | Returns a uniformly random bool4 value. |
NextDouble() | Returns a uniformly random double value in the interval [0, 1). |
NextDouble(double) | Returns a uniformly random double value in the interval [0, max). |
NextDouble(double, double) | Returns a uniformly random double value in the interval [min, max). |
NextDouble2() | Returns a uniformly random double2 value with all components in the interval [0, 1). |
NextDouble2(double2) | Returns a uniformly random double2 value with all components in the interval [0, max). |
NextDouble2(double2, double2) | Returns a uniformly random double2 value with all components in the interval [min, max). |
NextDouble2Direction() | Returns a unit length double2 vector representing a uniformly random 2D direction. |
NextDouble3() | Returns a uniformly random double3 value with all components in the interval [0, 1). |
NextDouble3(double3) | Returns a uniformly random double3 value with all components in the interval [0, max). |
NextDouble3(double3, double3) | Returns a uniformly random double3 value with all components in the interval [min, max). |
NextDouble3Direction() | Returns a unit length double3 vector representing a uniformly random 3D direction. |
NextDouble4() | Returns a uniformly random double4 value with all components in the interval [0, 1). |
NextDouble4(double4) | Returns a uniformly random double4 value with all components in the interval [0, max). |
NextDouble4(double4, double4) | Returns a uniformly random double4 value with all components in the interval [min, max). |
NextFloat() | Returns a uniformly random float value in the interval [0, 1). |
NextFloat(float) | Returns a uniformly random float value in the interval [0, max). |
NextFloat(float, float) | Returns a uniformly random float value in the interval [min, max). |
NextFloat2() | Returns a uniformly random float2 value with all components in the interval [0, 1). |
NextFloat2(float2) | Returns a uniformly random float2 value with all components in the interval [0, max). |
NextFloat2(float2, float2) | Returns a uniformly random float2 value with all components in the interval [min, max). |
NextFloat2Direction() | Returns a unit length float2 vector representing a uniformly random 2D direction. |
NextFloat3() | Returns a uniformly random float3 value with all components in the interval [0, 1). |
NextFloat3(float3) | Returns a uniformly random float3 value with all components in the interval [0, max). |
NextFloat3(float3, float3) | Returns a uniformly random float3 value with all components in the interval [min, max). |
NextFloat3Direction() | Returns a unit length float3 vector representing a uniformly random 3D direction. |
NextFloat4() | Returns a uniformly random float4 value with all components in the interval [0, 1). |
NextFloat4(float4) | Returns a uniformly random float4 value with all components in the interval [0, max). |
NextFloat4(float4, float4) | Returns a uniformly random float4 value with all components in the interval [min, max). |
NextInt() | Returns a uniformly random int value in the interval [-2147483647, 2147483647]. |
NextInt(int) | Returns a uniformly random int value in the interval [0, max). |
NextInt(int, int) | Returns a uniformly random int value in the interval [min, max). |
NextInt2() | Returns a uniformly random int2 value with all components in the interval [-2147483647, 2147483647]. |
NextInt2(int2) | Returns a uniformly random int2 value with all components in the interval [0, max). |
NextInt2(int2, int2) | Returns a uniformly random int2 value with all components in the interval [min, max). |
NextInt3() | Returns a uniformly random int3 value with all components in the interval [-2147483647, 2147483647]. |
NextInt3(int3) | Returns a uniformly random int3 value with all components in the interval [0, max). |
NextInt3(int3, int3) | Returns a uniformly random int3 value with all components in the interval [min, max). |
NextInt4() | Returns a uniformly random int4 value with all components in the interval [-2147483647, 2147483647]. |
NextInt4(int4) | Returns a uniformly random int4 value with all components in the interval [0, max). |
NextInt4(int4, int4) | Returns a uniformly random int4 value with all components in the interval [min, max). |
NextQuaternionRotation() | Returns a unit length quaternion representing a uniformly 3D rotation. |
NextUInt() | Returns a uniformly random uint value in the interval [0, 4294967294]. |
NextUInt(uint) | Returns a uniformly random uint value in the interval [0, max). |
NextUInt(uint, uint) | Returns a uniformly random uint value in the interval [min, max). |
NextUInt2() | Returns a uniformly random uint2 value with all components in the interval [0, 4294967294]. |
NextUInt2(uint2) | Returns a uniformly random uint2 value with all components in the interval [0, max). |
NextUInt2(uint2, uint2) | Returns a uniformly random uint2 value with all components in the interval [min, max). |
NextUInt3() | Returns a uniformly random uint3 value with all components in the interval [0, 4294967294]. |
NextUInt3(uint3) | Returns a uniformly random uint3 value with all components in the interval [0, max). |
NextUInt3(uint3, uint3) | Returns a uniformly random uint3 value with all components in the interval [min, max). |
NextUInt4() | Returns a uniformly random uint4 value with all components in the interval [0, 4294967294]. |
NextUInt4(uint4) | Returns a uniformly random uint4 value with all components in the interval [0, max). |
NextUInt4(uint4, uint4) | Returns a uniformly random uint4 value with all components in the interval [min, max). |