-
Notifications
You must be signed in to change notification settings - Fork 961
Closed as not planned
Description
I have encountered a strange issue.
When I use the following piece of code:
inline double random_double() {
static std::uniform_real_distribution<double> distribution(0.0, 1.0);
static std::mt19937 generator;
return distribution(generator);
}
inline double random_double(double min, double max) {
return min + (max - min) * random_double();
}The output in image.ppm is like this:

However, if I modify the code to this:
inline double random_double() { return rand() / (RAND_MAX + 1.0); }
I am not sure what is going wrong, and after a detailed review of the code, I couldn't find any issues.
How should I modify the program to address this?
Metadata
Metadata
Assignees
Labels
No labels
