random float
Some checks failed
CI / React UI Build (push) Successful in 11s
CI / Native Windows Build And Tests (push) Successful in 1m45s
CI / Windows Release Package (push) Has been cancelled

This commit is contained in:
2026-05-08 13:35:15 +10:00
parent c9fed70a60
commit 5eff189bbf
8 changed files with 27 additions and 8 deletions

View File

@@ -9,6 +9,7 @@
#include <algorithm>
#include <cmath>
#include <fstream>
#include <random>
#include <set>
#include <sstream>
@@ -55,6 +56,13 @@ bool MatchesControlKey(const std::string& candidate, const std::string& key)
return candidate == key || SimplifyControlKey(candidate) == SimplifyControlKey(key);
}
double GenerateStartupRandom()
{
std::random_device randomDevice;
std::uniform_real_distribution<double> distribution(0.0, 1.0);
return distribution(randomDevice);
}
bool TryParseLayerIdNumber(const std::string& layerId, uint64_t& number)
{
const std::string prefix = "layer-";
@@ -691,6 +699,7 @@ RuntimeHost::RuntimeHost()
mCompletionIntervalMilliseconds(0.0),
mSmoothedCompletionIntervalMilliseconds(0.0),
mMaxCompletionIntervalMilliseconds(0.0),
mStartupRandom(GenerateStartupRandom()),
mLateFrameCount(0),
mDroppedFrameCount(0),
mFlushedFrameCount(0),
@@ -1351,6 +1360,7 @@ void RuntimeHost::RefreshDynamicRenderStateFields(std::vector<RuntimeRenderState
state.timeSeconds = timeSeconds;
state.utcTimeSeconds = clock.utcTimeSeconds;
state.utcOffsetSeconds = clock.utcOffsetSeconds;
state.startupRandom = mStartupRandom;
state.frameCount = frameCount;
}
}

View File

@@ -167,6 +167,7 @@ private:
double mCompletionIntervalMilliseconds;
double mSmoothedCompletionIntervalMilliseconds;
double mMaxCompletionIntervalMilliseconds;
double mStartupRandom;
uint64_t mLateFrameCount;
uint64_t mDroppedFrameCount;
uint64_t mFlushedFrameCount;