diff options
Diffstat (limited to 'crawl-ref/source/stuff.h')
-rw-r--r-- | crawl-ref/source/stuff.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crawl-ref/source/stuff.h b/crawl-ref/source/stuff.h index 2a63276b7a..464fb1794d 100644 --- a/crawl-ref/source/stuff.h +++ b/crawl-ref/source/stuff.h @@ -233,10 +233,10 @@ int choose_random_weighted(Iterator beg, const Iterator end) int totalweight = 0; int count = 0, result = 0; - while ( beg != end ) + while (beg != end) { totalweight += *beg; - if ( random2(totalweight) < *beg ) + if (random2(totalweight) < *beg) { result = count; #if DEBUG @@ -246,7 +246,9 @@ int choose_random_weighted(Iterator beg, const Iterator end) ++count; ++beg; } +#if DEBUG ASSERT(times_set > 0); +#endif return result; } |