Browse Source

Protected the system Random from having its seed reset

tags/2021-05-28
Tom Poole 6 years ago
parent
commit
415dc54820
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      modules/juce_core/maths/juce_Random.cpp

+ 10
- 0
modules/juce_core/maths/juce_Random.cpp View File

@@ -38,6 +38,16 @@ Random::~Random() noexcept
void Random::setSeed (const int64 newSeed) noexcept
{
if (this == &getSystemRandom())
{
// Resetting the system Random risks messing up
// JUCE's internal state. If you need a predictable
// stream of random numbers you should use a local
// Random object.
jassertfalse;
return;
}
seed = newSeed;
}


Loading…
Cancel
Save