summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-04-16 15:22:13 +0800
committerKeuin <[email protected]>2022-04-16 15:22:17 +0800
commit52a8d9345762e7b2755ca78ae237058c8ebaa20c (patch)
tree764e4ed7e5e79039806ef1ce08c08bdab0418ee4
parentb26a0168788a28c384d394b9e3bb4ebaebc815c2 (diff)
Add vec3::range01_scalar.
-rw-r--r--vec.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/vec.h b/vec.h
index b233220..d2dece0 100644
--- a/vec.h
+++ b/vec.h
@@ -234,6 +234,11 @@ public:
}
}
+ // Get a random real number in range [0, 1].
+ inline T range01_scalar() {
+ return uni(mt);
+ };
+
// Get a unit vector with random direction.
inline vec3<T> normalized() {
return range01().unit_vec();