From 2e9facc4291f60844fa7619a3126bd6eb6be4599 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 20 Aug 2023 21:41:20 +0200 Subject: [PATCH] Add `Random::RandRange` --- Source/Engine/Core/Random.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Source/Engine/Core/Random.h b/Source/Engine/Core/Random.h index 805c687ab..2fdfc1449 100644 --- a/Source/Engine/Core/Random.h +++ b/Source/Engine/Core/Random.h @@ -14,4 +14,15 @@ namespace Random { return (float)rand() / (float)RAND_MAX; } + + /// + /// Generates a pseudo-random number from specific range. + /// + /// The minimum value (inclusive). + /// The maximum value (inclusive). + /// The random number. + inline float RandRange(float min, float max) + { + return min + (max - min) * Rand(); + } }