tutil.c: rename random function to avoid collision on BSD - granular - granular… | |
git clone git://src.adamsgaard.dk/granular | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 8562f7577153f279b2ce74b35a9016690ec9b7f1 | |
parent 3d5cc041769b612a57de8f5068a244c83b4612f9 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Fri, 19 Mar 2021 21:58:12 +0100 | |
util.c: rename random function to avoid collision on BSD | |
Diffstat: | |
M util.c | 6 +++--- | |
1 file changed, 3 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/util.c b/util.c | |
t@@ -87,7 +87,7 @@ residual(const double new_val, const double old_val) | |
} | |
double | |
-random(void) | |
+randomval(void) | |
{ | |
return (double)rand() / RAND_MAX; | |
} | |
t@@ -95,13 +95,13 @@ random(void) | |
double | |
random_value_uniform(double min, double max) | |
{ | |
- return random() * (max - min) + min; | |
+ return randomval() * (max - min) + min; | |
} | |
double | |
random_value_powerlaw(double min, double max) | |
{ | |
double power = -1.8; | |
- return pow((pow(max, power + 1.0) - pow(min, power + 1.0)) * random() | |
+ return pow((pow(max, power + 1.0) - pow(min, power + 1.0)) * randomval… | |
+ pow(min, power + 1.0), 1.0 / (power + 1.0)); | |
} |