'Why does using random_device in multithreaded program casuing runtime error?

I'm doing multithreaded program that gets a random string from a certain array

But i'm getting problems with random_device

terminate called after throwing an instance of 'std::runtime_error' what(): random_device::random_device(const std::string&) terminate called recursively


string getRandomproxy(){
   random_device random_device;
   mt19937 engine(random_device());
   uniform_int_distribution<int> dist(0,(proxies.size() - 1));
   
   return proxies[dist(engine)];

}
c++


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source