mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Fix timer condition not properly using random values
This commit is contained in:
parent
3ee913ea98
commit
3fe8ea8961
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@
|
|||
#include <QComboBox>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
#include <random>
|
||||
|
||||
namespace advss {
|
||||
|
||||
class MacroConditionTimer : public MacroCondition {
|
||||
|
|
@ -41,7 +39,6 @@ private:
|
|||
void SetVariables(double seconds);
|
||||
void SetupTempVars();
|
||||
|
||||
std::default_random_engine _re;
|
||||
static bool _registered;
|
||||
static const std::string id;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user