You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To seed random number generators, statismo uses the result of std::time(0). This is problematic because std::time(0) returns the time passed since epoch, measured in seconds. If multiple threads/process are started in very short time, the seed to the random number generator will always be the same, which is a problem if one wants to draw multiple samples from the same model/input in a parallel manner.
Of course there are ways to circumvent this issue, like ensuring that no two threads/processes are created in the same second. However, it would be more user friendly if the random number generator is initialized with more randomness.
Apparently, this is a bit more complicated than anticipated, but C++11 standard simplifies this considerably, as discussed in this article:
If @muefra's pull request #268 is merged, we could simply replace std::time(0) with std::random_device{}(). This should be completely fine in the context of statismo, because the the sampling wth gaussian processes is so heavily input-dependent, that certain biases in the random number generator (see the link above) will play a negligible role.
To seed random number generators, statismo uses the result of
std::time(0)
. This is problematic becausestd::time(0)
returns the time passed since epoch, measured in seconds. If multiple threads/process are started in very short time, the seed to the random number generator will always be the same, which is a problem if one wants to draw multiple samples from the same model/input in a parallel manner.Of course there are ways to circumvent this issue, like ensuring that no two threads/processes are created in the same second. However, it would be more user friendly if the random number generator is initialized with more randomness.
Apparently, this is a bit more complicated than anticipated, but C++11 standard simplifies this considerably, as discussed in this article:
http://www.pcg-random.org/posts/cpp-seeding-surprises.html
The text was updated successfully, but these errors were encountered: