From e3392e343f7de1eadb12f8080c96be6b65c432e7 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Sat, 14 Nov 2009 16:53:43 +0100 Subject: Document random_choose_weighted. --- crawl-ref/source/random-weight.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'crawl-ref/source/random-weight.h') diff --git a/crawl-ref/source/random-weight.h b/crawl-ref/source/random-weight.h index 7b9995520f..2c7f8b9bca 100644 --- a/crawl-ref/source/random-weight.h +++ b/crawl-ref/source/random-weight.h @@ -1,6 +1,12 @@ #ifndef RANDOM_WEIGHT_H #define RANDOM_WEIGHT_H +/* + * Weighted choice. + * + * Weights are assumed to be non-negative, but are allowed to be zero. + * Returns NULL if nothing found, i.e., if all weights are zero. + */ template T* random_choose_weighted(std::vector > choices) { -- cgit v1.2.3-54-g00ecf