mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
Protected the system Random from having its seed reset
This commit is contained in:
parent
e5d1e0008e
commit
415dc54820
1 changed files with 10 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue