Skip to content

Commit 429b57a

Browse files
committed
Clarify random_double(min,max) implementation
Resolves #1681
1 parent 1c501bc commit 429b57a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Change Log / Ray Tracing in One Weekend
55

66
### Common
77
- Fix -- Fixed some dangling references to `random_in_unit_sphere()` (#1637)
8+
- Fix -- Clarify `uniform_real_distribution` usage for `random_double()` (#1680)
89

910
### In One Weekend
1011
- Fix -- Fix equation for refracted rays of non-unit length (#1644)

books/RayTracingInOneWeekend.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,6 +2044,13 @@
20442044
}
20452045
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
20462046

2047+
inline double random_double(double min, double max) {
2048+
// Returns a random real in [min,max).
2049+
return min + (max-min)*random_double();
2050+
}
2051+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
2052+
2053+
20472054
...
20482055

20492056
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)