diff options
| author | Paul Eggert | 2018-08-18 15:39:05 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-08-18 15:42:00 -0700 |
| commit | 97d273033b523bc07911c848d4e8bf96cdce0c90 (patch) | |
| tree | 1def37fdbac9d108c5930a15d1538982f40b52a7 | |
| parent | 673b1785db4604efe81b8045a9d8ab68936af719 (diff) | |
| download | emacs-97d273033b523bc07911c848d4e8bf96cdce0c90.tar.gz emacs-97d273033b523bc07911c848d4e8bf96cdce0c90.zip | |
Document that ‘random’ is limited to fixnums
Problem reported by Pip Cet (Bug#32463#20).
* doc/lispref/numbers.texi (Random Numbers):
* src/fns.c (Frandom): Adjust doc.
| -rw-r--r-- | doc/lispref/numbers.texi | 7 | ||||
| -rw-r--r-- | src/fns.c | 9 |
2 files changed, 6 insertions, 10 deletions
diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi index ee6456b1be1..74a313e2e10 100644 --- a/doc/lispref/numbers.texi +++ b/doc/lispref/numbers.texi | |||
| @@ -1236,11 +1236,10 @@ other strings to choose various seed values. | |||
| 1236 | This function returns a pseudo-random integer. Repeated calls return a | 1236 | This function returns a pseudo-random integer. Repeated calls return a |
| 1237 | series of pseudo-random integers. | 1237 | series of pseudo-random integers. |
| 1238 | 1238 | ||
| 1239 | If @var{limit} is a positive integer, the value is chosen to be | 1239 | If @var{limit} is a positive fixnum, the value is chosen to be |
| 1240 | nonnegative and less than @var{limit}. Otherwise, the value might be | 1240 | nonnegative and less than @var{limit}. Otherwise, the value might be |
| 1241 | any integer representable in Lisp, i.e., an integer between | 1241 | any fixnum, i.e., any integer from @code{most-negative-fixnum} through |
| 1242 | @code{most-negative-fixnum} and @code{most-positive-fixnum} | 1242 | @code{most-positive-fixnum} (@pxref{Integer Basics}). |
| 1243 | (@pxref{Integer Basics}). | ||
| 1244 | 1243 | ||
| 1245 | If @var{limit} is @code{t}, it means to choose a new seed as if Emacs | 1244 | If @var{limit} is @code{t}, it means to choose a new seed as if Emacs |
| 1246 | were restarting, typically from the system entropy. On systems | 1245 | were restarting, typically from the system entropy. On systems |
| @@ -56,15 +56,12 @@ DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0, | |||
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | DEFUN ("random", Frandom, Srandom, 0, 1, 0, | 58 | DEFUN ("random", Frandom, Srandom, 0, 1, 0, |
| 59 | doc: /* Return a pseudo-random number. | 59 | doc: /* Return a pseudo-random integer. |
| 60 | All integers representable in Lisp, i.e. between `most-negative-fixnum' | 60 | By default, return a fixnum; all fixnums are equally likely. |
| 61 | and `most-positive-fixnum', inclusive, are equally likely. | 61 | With positive fixnum LIMIT, return random integer in interval [0,LIMIT). |
| 62 | |||
| 63 | With positive integer LIMIT, return random number in interval [0,LIMIT). | ||
| 64 | With argument t, set the random number seed from the system's entropy | 62 | With argument t, set the random number seed from the system's entropy |
| 65 | pool if available, otherwise from less-random volatile data such as the time. | 63 | pool if available, otherwise from less-random volatile data such as the time. |
| 66 | With a string argument, set the seed based on the string's contents. | 64 | With a string argument, set the seed based on the string's contents. |
| 67 | Other values of LIMIT are ignored. | ||
| 68 | 65 | ||
| 69 | See Info node `(elisp)Random Numbers' for more details. */) | 66 | See Info node `(elisp)Random Numbers' for more details. */) |
| 70 | (Lisp_Object limit) | 67 | (Lisp_Object limit) |