summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/stuff.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-25 17:04:20 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-25 17:04:20 +0000
commitb1c2d6e096eebdbae0c2f5a8dd48a5f67a1eb678 (patch)
tree9d9ef2508041df23a59c5bc447cc4ee8633944c5 /crawl-ref/source/stuff.cc
parent287e5f0820620b81b518ab1f554107afd8a62ebe (diff)
downloadcrawl-ref-b1c2d6e096eebdbae0c2f5a8dd48a5f67a1eb678.tar.gz
crawl-ref-b1c2d6e096eebdbae0c2f5a8dd48a5f67a1eb678.zip
Complete rewrite of the beam code, making it considerably saner.
However, there might be quite a few bugs lurking in this rewrite. Sorry. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7975 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/stuff.cc')
-rw-r--r--crawl-ref/source/stuff.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index b6fd4527cc..6a2eb44922 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -587,6 +587,16 @@ bool coinflip( void )
return (static_cast<bool>( random2(2) ));
}
+// Returns random2(x) if random_factor is true, otherwise the mean.
+int maybe_random2( int x, bool random_factor )
+{
+ if (random_factor)
+ return random2(x);
+ else
+ return x / 2;
+}
+
+
void push_rng_state()
{
push_mt_state();