From 52a8d9345762e7b2755ca78ae237058c8ebaa20c Mon Sep 17 00:00:00 2001 From: Keuin Date: Sat, 16 Apr 2022 15:22:13 +0800 Subject: Add vec3::range01_scalar. --- vec.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'vec.h') 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 normalized() { return range01().unit_vec(); -- cgit v1.2.3