I need pseudo-random floats to generate a sampling pattern. However, whenever I run the app with the same parameters, I want to get exactly the same pattern, so I want to use a fixed seed. I am generating these samples in multiple threads simultaneously. unfortunately std::srand()
is not thread-safe and whether std::rand()
is thread-safe depends on the implementation.
how can I generate random numbers with fixed seed per thread in c++ in a thread-safe manner?
Aucun commentaire:
Enregistrer un commentaire