summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/stuff.h
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-06 16:47:06 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-06 16:47:06 +0000
commit200b4c0e08504a7c8df898d77a9d72b3fa573c04 (patch)
treeb6cf73c902a55861ab60656e0225f0385c2c3a59 /crawl-ref/source/stuff.h
parent7f2ded93231941b48fba24bcc9a55602295f72bd (diff)
downloadcrawl-ref-200b4c0e08504a7c8df898d77a9d72b3fa573c04.tar.gz
crawl-ref-200b4c0e08504a7c8df898d77a9d72b3fa573c04.zip
Add a function x_chance_in_y(x,y) to replace the various
random2(y) < x checks, e.g. x_chance_in_y(weight, totalweight). This should make things a bit more readable. Apply it to a number of files. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6428 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/stuff.h')
-rw-r--r--crawl-ref/source/stuff.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/crawl-ref/source/stuff.h b/crawl-ref/source/stuff.h
index 2883e3cacf..60c2ae4305 100644
--- a/crawl-ref/source/stuff.h
+++ b/crawl-ref/source/stuff.h
@@ -34,6 +34,7 @@ bool coinflip();
int div_rand_round( int num, int den );
int div_round_up( int num, int den );
bool one_chance_in(int a_million);
+bool x_chance_in_y(int x, int y);
int random2(int randmax);
int random_range(int low, int high);
int random_range(int low, int high, int nrolls);