| @@ -758,6 +758,8 @@ void Engine::addModule(Module* module) { | |||||
| DISTRHO_SAFE_ASSERT_RETURN(it == internal->modules.end(),); | DISTRHO_SAFE_ASSERT_RETURN(it == internal->modules.end(),); | ||||
| auto tit = std::find(internal->terminalModules.begin(), internal->terminalModules.end(), module); | auto tit = std::find(internal->terminalModules.begin(), internal->terminalModules.end(), module); | ||||
| DISTRHO_SAFE_ASSERT_RETURN(tit == internal->terminalModules.end(),); | DISTRHO_SAFE_ASSERT_RETURN(tit == internal->terminalModules.end(),); | ||||
| // Reinitialize random module since it uses thread-local RNG state | |||||
| random::init(); | |||||
| // Set ID if unset or collides with an existing ID | // Set ID if unset or collides with an existing ID | ||||
| while (module->id < 0 || internal->modulesCache.find(module->id) != internal->modulesCache.end()) { | while (module->id < 0 || internal->modulesCache.find(module->id) != internal->modulesCache.end()) { | ||||
| // Randomly generate ID | // Randomly generate ID | ||||
| @@ -1003,6 +1005,8 @@ void Engine::addCable(Cable* cable) { | |||||
| if (cable2->outputModule == cable->outputModule && cable2->outputId == cable->outputId) | if (cable2->outputModule == cable->outputModule && cable2->outputId == cable->outputId) | ||||
| outputWasConnected = true; | outputWasConnected = true; | ||||
| } | } | ||||
| // Reinitialize random module since it uses thread-local RNG state | |||||
| random::init(); | |||||
| // Set ID if unset or collides with an existing ID | // Set ID if unset or collides with an existing ID | ||||
| while (cable->id < 0 || internal->cablesCache.find(cable->id) != internal->cablesCache.end()) { | while (cable->id < 0 || internal->cablesCache.find(cable->id) != internal->cablesCache.end()) { | ||||
| // Randomly generate ID | // Randomly generate ID | ||||