summaryrefslogtreecommitdiff
path: root/base/random.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/random.cc')
-rw-r--r--base/random.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/base/random.cc b/base/random.cc
index cfa94b5e3..4aac14101 100644
--- a/base/random.cc
+++ b/base/random.cc
@@ -63,18 +63,18 @@ getLong()
}
int64_t
-getUniform(int64_t maxmin)
+getUniform(int64_t min, int64_t max)
{
double r;
- r = (drand48() - 0.500) * 2 * maxmin;
+ r = drand48() * (max-min) + min;
return (int64_t)round(r);
}
uint64_t
-getUniformPos(uint64_t max)
+getUniformPos(uint64_t min, uint64_t max)
{
double r;
- r = drand48() * 2 * max;
+ r = drand48() * (max-min) + min;
return (uint64_t)round(r);
}