Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Randomization glitches with MFR (SDK)

Engaged ,
Sep 25, 2024 Sep 25, 2024

I'm getting some strange glitches in my plugin I'm developing when using MFR.

 

This effect calls for many random numbers every frame to generate boxes and place them in random positions.

 

It's a relatively simple plugin so there's not much more to it than that. However, when caching for a preview, some frames have the boxes in the same position as the previous frame. If I disable MFR from Settings - > Preferences -> Memory & Performance it goes away and every frame has correct random box positions. So that's how I'm assuming it has to do with MFR.

 

I'm not using any out of the box functions just your bases srand() for see initialization and rand() for generating a new number.

 

I even tried a thread-safe random generator but the issue persists:

 

int intRand(const int & min, const int & max) {
    static thread_local std::mt19937 generator;
    std::uniform_int_distribution<int> distribution(min,max);
    return distribution(generator);
}

 

Any ideas what could be causing this? Has anyone else had similar issues?

 

I should also say that it's the first bunch of frames that tend to have more issues and then they have fewer.

 

-Richard

TOPICS
SDK
148
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 25, 2024 Sep 25, 2024
LATEST

possibly a re-entrancy issue.

is it possible that the value on which you base your srand() is being asynchronously overritten between the entry point and the call for srand()?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines