summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/random.h
diff options
context:
space:
mode:
authorPete Hurst <pete@streamuniverse.tv>2013-05-23 02:14:55 +0100
committerPete Hurst <pete@streamuniverse.tv>2013-06-23 05:01:11 +0100
commit6c024bad6f0942116c508e5948fdf40c3a0d4dfe (patch)
treeb1989a9bae12a7015db8f8c76abc8f8ecb189409 /crawl-ref/source/random.h
parentc8ffa77dd4fada4dd85c5007889014b8c295b204 (diff)
downloadcrawl-ref-6c024bad6f0942116c508e5948fdf40c3a0d4dfe.tar.gz
crawl-ref-6c024bad6f0942116c508e5948fdf40c3a0d4dfe.zip
Add new random functions random_real_inc, random_real_avg, random_range_real
random_real_inc Returns a value [0..1]. random_real() was not inclusive of 1.0. random_real_avg Returns a real value taking the average of a given number of rolls. random_range_real Returns a real value in a given range (with optional number of rolls).
Diffstat (limited to 'crawl-ref/source/random.h')
-rw-r--r--crawl-ref/source/random.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/crawl-ref/source/random.h b/crawl-ref/source/random.h
index a00ddb9b44..ffa3497b14 100644
--- a/crawl-ref/source/random.h
+++ b/crawl-ref/source/random.h
@@ -18,6 +18,9 @@ int maybe_roll_dice(int num, int size, bool random);
int random_range(int low, int high);
int random_range(int low, int high, int nrolls);
double random_real();
+double random_real_inc();
+double random_real_avg(int rolls);
+double random_range_real(double low, double high, int nrolls = 1);
int random2avg(int max, int rolls);
int bestroll(int max, int rolls);