aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/core/SkRandom.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/core/SkRandom.h b/include/core/SkRandom.h
index b1b7564b1f..c033f407c1 100644
--- a/include/core/SkRandom.h
+++ b/include/core/SkRandom.h
@@ -81,6 +81,13 @@ public:
SkScalar nextUScalar1() { return SkFixedToScalar(this->nextUFixed1()); }
/** Return the next pseudo random number expressed as a SkScalar
+ in the range [min..max).
+ */
+ SkScalar nextRangeScalar(SkScalar min, SkScalar max) {
+ return SkScalarMul(this->nextSScalar1(), (max - min)) + min;
+ }
+
+ /** Return the next pseudo random number expressed as a SkScalar
in the range (-SK_Scalar1..SK_Scalar1).
*/
SkScalar nextSScalar1() { return SkFixedToScalar(this->nextSFixed1()); }