add basic c++ project setup

This commit is contained in:
2026-04-19 10:19:27 +02:00
parent 1e1f2d7816
commit 8b740dfe8e
36 changed files with 16842 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
#include "RandomBinaryFunction.h"
#include "utilityRandom.h"
RandomBinaryFunction::RandomBinaryFunction(float resolution_s, float stateChangeProbability)
: m_resolution_s(resolution_s)
, m_stateChangeProbability(stateChangeProbability)
, m_passedTime_s(0.0f)
, m_value(utility::getRandomBool())
{
}
void RandomBinaryFunction::update(float deltaTime_s)
{
m_passedTime_s += deltaTime_s;
while (m_passedTime_s >= m_resolution_s)
{
m_passedTime_s -= m_resolution_s;
if (utility::getRandomFloat() >= m_stateChangeProbability)
{
m_value = !m_value;
}
}
}
bool RandomBinaryFunction::getValue() const
{
return m_value;
}