summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-11-08 18:04:41 -0800
committerMatthew Cline <zelgadis@sourceforge.net>2009-11-08 18:04:41 -0800
commit0a3c856d3d36b49a8430fe9468d2f11ae234f9c8 (patch)
treea87219ba2bf40fb56989a6536e34470bd0ebba98 /crawl-ref/source
parent61a3e40c9b96c8ea1947ca0d7ad3a3272e844211 (diff)
downloadcrawl-ref-0a3c856d3d36b49a8430fe9468d2f11ae234f9c8.tar.gz
crawl-ref-0a3c856d3d36b49a8430fe9468d2f11ae234f9c8.zip
random.h: More comments for defer_rand
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/random.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/crawl-ref/source/random.h b/crawl-ref/source/random.h
index b4d48639c9..1b71986b4b 100644
--- a/crawl-ref/source/random.h
+++ b/crawl-ref/source/random.h
@@ -57,6 +57,16 @@ public:
// * The parameter you use on any given call does not matter.
// * The object stores the fraction, not a specific integer.
// * random2() is monotonic in its argument.
+
+// Rephrased: The first time any node in the tree has a method called on
+// it, a random float between 0 and 1 (the fraction) is generated and stored,
+// and this float is combined with the method's parameters to arrive at
+// the result. Calling the same method on the same node with the same
+// parameters will always give the same result, while different parameters
+// or methods will give different results (though they'll all use the same
+// float which was generated by the first method call). Each node in the
+// tree has it's own float, so the same method+parameters on different
+// nodes will get different results.
class defer_rand
{
std::vector<unsigned long> bits;