Add rsRand(float, float) support back to compat lib.
Change-Id: I0acaa409908f83c690c95b47979f820bc2dac9f5
diff --git a/cpu_ref/rsCpuRuntimeMath.cpp b/cpu_ref/rsCpuRuntimeMath.cpp
index ee82328..04a80e0 100644
--- a/cpu_ref/rsCpuRuntimeMath.cpp
+++ b/cpu_ref/rsCpuRuntimeMath.cpp
@@ -96,7 +96,7 @@
m->transpose();
}
-static float SC_randf2(float min, float max) {
+float SC_randf2(float min, float max) {
float r = (float)rand();
r /= RAND_MAX;
r = r * (max - min) + min;
diff --git a/cpu_ref/rsCpuRuntimeMathFuncs.cpp b/cpu_ref/rsCpuRuntimeMathFuncs.cpp
index a1d7aff..6694a8a 100644
--- a/cpu_ref/rsCpuRuntimeMathFuncs.cpp
+++ b/cpu_ref/rsCpuRuntimeMathFuncs.cpp
@@ -86,6 +86,12 @@
IMPORT_F32_FN_F32(tgamma)
IMPORT_F32_FN_F32(trunc)
+extern float SC_randf2(float min, float max);
+float __attribute__((overloadable)) rsRand(float min, float max) {
+ return SC_randf2(min, max);
+}
+
+
// !!! DANGER !!!
// These functions are potentially missing on older Android versions.
// Work around the issue by supplying our own variants.