summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-01-18 06:24:09 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-01-18 06:24:09 -0800
commitcc8f11bf43842e38f0a515b8070f4a7afe9a716d (patch)
treec5110ac4e87d541fca5405e78ae29c585242af62 /txr.1
parenta1c7cc2f9faf4463722e78f24b9433dc9cf0bbf7 (diff)
downloadtxr-cc8f11bf43842e38f0a515b8070f4a7afe9a716d.tar.gz
txr-cc8f11bf43842e38f0a515b8070f4a7afe9a716d.tar.bz2
txr-cc8f11bf43842e38f0a515b8070f4a7afe9a716d.zip
Don't allow non-positive modulus in rand and random.
* rand.c (random): In fixnum case, allow only m >= 1. The code is restructured so that this check is done before we do some arithmetic with derived values, where the behavior can become undefined. * txr.1: Document the restriction on modulus range for rand and random.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.17
1 files changed, 7 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 5f8a4c3b..9568e6b1 100644
--- a/txr.1
+++ b/txr.1
@@ -34829,6 +34829,13 @@ object is the second argument and is optional. If it is omitted, the global
.code *random-state*
object is used.
+The
+.meta modulus
+argument must be a positive integer. If
+.meta modulus
+is 1, then the function returns zero without altering the state of the
+pseudo-random number generator.
+
.SS* Time
.coNP Functions @ time and @ time-usec
.synb