mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Util/Random: Add randtime(Milliseconds const&, Milliseconds const&) to supersede urandms(uint32,uint32) for scripts being ported to std::chrono.
(cherry picked from commit 224b42c53a)
This commit is contained in:
@@ -61,6 +61,14 @@ float frand(float min, float max)
|
||||
return float(GetRng()->Random() * (max - min) + min);
|
||||
}
|
||||
|
||||
Milliseconds randtime(Milliseconds const& min, Milliseconds const& max)
|
||||
{
|
||||
long long diff = max.count() - min.count();
|
||||
ASSERT(diff >= 0);
|
||||
ASSERT(diff <= (uint32)-1);
|
||||
return min + Milliseconds(urand(0, diff));
|
||||
}
|
||||
|
||||
uint32 rand32()
|
||||
{
|
||||
return GetRng()->BRandom();
|
||||
|
||||
Reference in New Issue
Block a user