Open
Description
std::rand returns an integer when divided by RAND_MAX, the result will always be 0.
In Ray Tracing In One Weekend
inline double random_double() {
// Returns a random real in [0,1).
return std::rand() / (RAND_MAX + 1.0);
}
Should be (following book style)
inline double random_double() {
// Returns a random real in [0,1).
return double(std::rand()) / (RAND_MAX + 1.0);
}
Happy to make the change myself, just following the contribution guide.
PS: Thank you for the great books and all the work you put into this!! Let me know if you have a donate button somewhere (I couldn't find any), would love to buy you a coffee :).