Quantum 3 3.0.3

Static Public Member Functions | List of all members
Quantum.RNGExtensions Class Reference

Extension methods for the RNGSession struct to provide additional random number generation functionality for quaternions, colors, and vectors in various geometric distributions. More...

Static Public Member Functions

static ColorRGBA ColorHSV (this ref RNGSession rng)
 Generates a random color using HSV values, converted to RGB. More...
 
static FPVector2 InUnitCircle (this ref RNGSession rng, bool uniform=false)
 Returns a random 2D vector inside the unit circle. More...
 
static FPVector3 InUnitSphere (this ref RNGSession rng, bool uniform=false)
 Returns a random point inside the unit sphere. More...
 
static FPVector2 OnUnitCircle (this ref RNGSession rng)
 Returns a random point on the perimeter of the unit circle. More...
 
static FPVector3 OnUnitSphere (this ref RNGSession rng, bool uniform=false)
 Returns a random point on the surface of the unit sphere. More...
 
static FPQuaternion Rotation (this ref RNGSession rng)
 Generates a random quaternion with each component in the range [0,1]. More...
 

Detailed Description

Extension methods for the RNGSession struct to provide additional random number generation functionality for quaternions, colors, and vectors in various geometric distributions.

Member Function Documentation

◆ Rotation()

static FPQuaternion Quantum.RNGExtensions.Rotation ( this ref RNGSession  rng)
inlinestatic

Generates a random quaternion with each component in the range [0,1].

Parameters
rngThe random number generator session.
Returns
A randomly generated quaternion.

◆ ColorHSV()

static ColorRGBA Quantum.RNGExtensions.ColorHSV ( this ref RNGSession  rng)
inlinestatic

Generates a random color using HSV values, converted to RGB.

Parameters
rngThe random number generator session.
Returns
A randomly generated color in RGBA format.

◆ InUnitCircle()

static FPVector2 Quantum.RNGExtensions.InUnitCircle ( this ref RNGSession  rng,
bool  uniform = false 
)
inlinestatic

Returns a random 2D vector inside the unit circle.

Parameters
rngThe random number generator session.
uniformIf true, distribution is uniform over the area. Note: This requires an additional square root operation which has a minor performance cost but provides better distribution.
Returns
A random 2D vector inside the unit circle.

◆ OnUnitCircle()

static FPVector2 Quantum.RNGExtensions.OnUnitCircle ( this ref RNGSession  rng)
inlinestatic

Returns a random point on the perimeter of the unit circle.

Parameters
rngThe random number generator session.
Returns
A random point on the unit circle perimeter.

◆ InUnitSphere()

static FPVector3 Quantum.RNGExtensions.InUnitSphere ( this ref RNGSession  rng,
bool  uniform = false 
)
inlinestatic

Returns a random point inside the unit sphere.

Parameters
rngThe random number generator session.
uniformIf true, distribution is uniform over the volume. Note: This requires an additional cube root calculation which has a higher performance cost but provides a statistically correct distribution of points throughout the volume.
Returns
A random point inside the unit sphere.

◆ OnUnitSphere()

static FPVector3 Quantum.RNGExtensions.OnUnitSphere ( this ref RNGSession  rng,
bool  uniform = false 
)
inlinestatic

Returns a random point on the surface of the unit sphere.

Parameters
rngThe random number generator session.
uniformIf true, points are uniformly distributed over the surface. Note: The uniform distribution uses a different algorithm which has a minor performance impact but ensures points are not clustered at the poles of the sphere.
Returns
A random point on the unit sphere surface.