UnityMinMaxExtensions
Namespace: Shadop.Archmage.Sdk
Extension methods for MinMax.
public static class UnityMinMaxExtensionsInheritance Object → UnityMinMaxExtensions
Supported Types
Section titled “Supported Types”To maximize performance and avoid garbage collection (GC) allocations in Unity, these extensions provide explicit, hardcoded overloads for standard numeric types.
The underlying generic type T can be one of the following:
- Integer Types:
sbyte,short,int,long,byte,ushort,uint,ulong - Floating-point Types:
float,double - Duration: Duration
Note: The documentation below uses a generic syntax <T> for brevity, but the actual implementation uses explicit overloads for the types listed above.
Methods
Section titled “Methods”Sample(MinMax<T>)
Section titled “Sample(MinMax<T>)”Draws a uniform random value from the MinMax range using Unity’s global UnityEngine.Random. The returned value lies in [Min, Max] (both ends included).
For integer types, this maps to Random.Range(0, span + 1) shifted by Min. For floating-point types, this uses Random.value * (Max - Min) shifted by Min. For Duration, the draw has millisecond precision.
public static T Sample(this MinMax<T> mm)Returns
Section titled “Returns”T
A random value in the range [mm.Min, mm.Max].