Add Random::RandRange

This commit is contained in:
Wojtek Figat
2023-08-20 21:41:20 +02:00
parent a44c1521af
commit 2e9facc429

View File

@@ -14,4 +14,15 @@ namespace Random
{
return (float)rand() / (float)RAND_MAX;
}
/// <summary>
/// Generates a pseudo-random number from specific range.
/// </summary>
/// <param name="min">The minimum value (inclusive).</param>
/// <param name="max">The maximum value (inclusive).</param>
/// <returns>The random number.</returns>
inline float RandRange(float min, float max)
{
return min + (max - min) * Rand();
}
}