mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-12 04:11:06 -05:00
Fix timer condition not properly using random values
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "macro-condition-timer.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
|
||||
#include <random>
|
||||
|
||||
namespace advss {
|
||||
|
||||
const std::string MacroConditionTimer::id = "timer";
|
||||
@@ -17,6 +19,9 @@ const static std::map<MacroConditionTimer::TimerType, std::string> timerTypes =
|
||||
"AdvSceneSwitcher.condition.timer.type.random"},
|
||||
};
|
||||
|
||||
static std::random_device rd;
|
||||
static std::default_random_engine re(rd());
|
||||
|
||||
bool MacroConditionTimer::CheckCondition()
|
||||
{
|
||||
if (_paused) {
|
||||
@@ -48,7 +53,7 @@ void MacroConditionTimer::SetRandomTimeRemaining()
|
||||
}
|
||||
std::uniform_real_distribution<double> unif(min, max);
|
||||
|
||||
double remainingTime = unif(_re);
|
||||
double remainingTime = unif(re);
|
||||
_duration.SetTimeRemaining(remainingTime);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user