summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/random.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-11-14 17:21:58 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-11-15 21:03:43 +0100
commit04ab49bde8bfadd87c7897b3319238b1da561812 (patch)
treeafd986d551f519de290313bb485d0ee1bfa743c2 /crawl-ref/source/random.cc
parent51aa1dcc06634d7d1851e964ac63b3c1fca3e1cf (diff)
downloadcrawl-ref-04ab49bde8bfadd87c7897b3319238b1da561812.tar.gz
crawl-ref-04ab49bde8bfadd87c7897b3319238b1da561812.zip
Drop unnecessary parentheses from return statements.
Diffstat (limited to 'crawl-ref/source/random.cc')
-rw-r--r--crawl-ref/source/random.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/crawl-ref/source/random.cc b/crawl-ref/source/random.cc
index ec4ebfec8c..6c0b18edb0 100644
--- a/crawl-ref/source/random.cc
+++ b/crawl-ref/source/random.cc
@@ -166,7 +166,7 @@ int maybe_random2(int x, bool random_factor)
if (random_factor)
return random2(x);
else
- return (x / 2);
+ return x / 2;
}
// [0, ceil(nom/denom)]
@@ -175,9 +175,9 @@ int maybe_random_div(int nom, int denom, bool random_factor)
if (nom <= 0)
return 0;
if (random_factor)
- return (random2(nom + denom) / denom);
+ return random2(nom + denom) / denom;
else
- return (nom / 2 / denom);
+ return nom / 2 / denom;
}
// [num, num*size]
@@ -259,7 +259,7 @@ int div_rand_round(int num, int den)
if (rem)
return (num / den + (random2(den) < rem));
else
- return (num / den);
+ return num / den;
}
// [0, max)
@@ -287,7 +287,7 @@ int random2avg(int max, int rolls)
for (int i = 0; i < (rolls - 1); i++)
sum += random2(max + 1);
- return (sum / rolls);
+ return sum / rolls;
}
// biased_random2() takes values in the same range [0, max) as random2() but
@@ -359,7 +359,7 @@ double random_real_avg(int rolls)
for (int i = 0; i < rolls; i++)
sum += random_real_inc();
- return (sum / (double)rolls);
+ return sum / (double)rolls;
}
// range [low, high], weighted to middle with multiple rolls
@@ -381,7 +381,7 @@ bool bernoulli(double n_trials, double trial_prob)
bool one_chance_in(int a_million)
{
- return (random2(a_million) == 0);
+ return random2(a_million) == 0;
}
bool x_chance_in_y(int x, int y)
@@ -392,7 +392,7 @@ bool x_chance_in_y(int x, int y)
if (x >= y)
return true;
- return (random2(y) < x);
+ return random2(y) < x;
}
// [val - lowfuzz, val + highfuzz]
@@ -476,5 +476,5 @@ int defer_rand::random2avg(int max, int rolls)
for (int i = 0; i < (rolls - 1); i++)
sum += (*this)[i+1].random2(max + 1);
- return (sum / rolls);
+ return sum / rolls;
}