Rename global rng() to sharedRng()

This commit is contained in:
Martin Hořeňovský 2022-05-17 15:37:14 +02:00
parent 9c72b303d9
commit 359cd6187d
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
4 changed files with 5 additions and 5 deletions

View File

@ -25,7 +25,7 @@ class RandomFloatingGenerator final : public IGenerator<Float> {
public: public:
RandomFloatingGenerator(Float a, Float b): RandomFloatingGenerator(Float a, Float b):
m_rng(rng()), m_rng(sharedRng()),
m_dist(a, b) { m_dist(a, b) {
static_cast<void>(next()); static_cast<void>(next());
} }
@ -47,7 +47,7 @@ class RandomIntegerGenerator final : public IGenerator<Integer> {
public: public:
RandomIntegerGenerator(Integer a, Integer b): RandomIntegerGenerator(Integer a, Integer b):
m_rng(rng()), m_rng(sharedRng()),
m_dist(a, b) { m_dist(a, b) {
static_cast<void>(next()); static_cast<void>(next());
} }

View File

@ -55,7 +55,7 @@ namespace Catch {
Context::~Context() = default; Context::~Context() = default;
SimplePcg32& rng() { SimplePcg32& sharedRng() {
static SimplePcg32 s_rng; static SimplePcg32 s_rng;
return s_rng; return s_rng;
} }

View File

@ -50,7 +50,7 @@ namespace Catch {
void cleanUpContext(); void cleanUpContext();
class SimplePcg32; class SimplePcg32;
SimplePcg32& rng(); SimplePcg32& sharedRng();
} }
#endif // CATCH_CONTEXT_HPP_INCLUDED #endif // CATCH_CONTEXT_HPP_INCLUDED

View File

@ -598,7 +598,7 @@ namespace Catch {
} }
void seedRng(IConfig const& config) { void seedRng(IConfig const& config) {
rng().seed(config.rngSeed()); sharedRng().seed(config.rngSeed());
} }
unsigned int rngSeed() { unsigned int rngSeed() {