projects
/
supertux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
821ebaf
)
Remove bogus asserts, fixes Coverity #29378 and #29408
author
Tobias Markus
<tobbi@mozilla-uk.org>
Sat, 14 Feb 2015 16:22:18 +0000
(17:22 +0100)
committer
Tobias Markus
<tobbi@mozilla-uk.org>
Sat, 14 Feb 2015 16:24:06 +0000
(17:24 +0100)
src/math/random_generator.cpp
patch
|
blob
|
history
diff --git
a/src/math/random_generator.cpp
b/src/math/random_generator.cpp
index
fe4086b
..
6429c53
100644
(file)
--- a/
src/math/random_generator.cpp
+++ b/
src/math/random_generator.cpp
@@
-87,11
+87,10
@@
int RandomGenerator::rand() {
}
int RandomGenerator::rand(int v) {
- assert(v >= 0
&& v <= RandomGenerator::rand_max
); // illegal arg
+ assert(v >= 0); // illegal arg
// remove biases, esp. when v is large (e.g. v == (rand_max/4)*3;)
int rv, maxV =(RandomGenerator::rand_max / v) * v;
- assert(maxV <= RandomGenerator::rand_max);
while ((rv = RandomGenerator::random()) >= maxV)
;
return rv % v; // mod it down to 0..(maxV-1)