math/mprand.[ch], rand/grand.c: Check range of arguments.
[catacomb] / math / mprand.h
index 0c193c0..a088df8 100644 (file)
@@ -58,6 +58,9 @@
  *             uniformly distributed in the interval %$[2^{b - 1}, 2^b)$%.
  *             The result is then ORred with the given @or@ value.  This
  *             will often be 1, to make the result odd.
+ *
+ *             The length @b@ may be zero; but %$\texttt{or} \ge 2^b$% is
+ *             not permitted.
  */
 
 extern mp *mprand(mp */*d*/, unsigned /*b*/, grand */*r*/, mpw /*or*/);
@@ -73,7 +76,7 @@ extern mp *mprand(mp */*d*/, unsigned /*b*/, grand */*r*/, mpw /*or*/);
  *             interval %$[0, l)$%.
  *
  * Use:                Generates a uniformly-distributed pseudorandom number in the
- *             appropriate range.
+ *             appropriate range.  We must have %$l > 0$%.
  */
 
 extern mp *mprand_range(mp */*d*/, mp */*l*/, grand */*r*/, mpw /*or*/);