Skip to content

Commit

Permalink
doc: pseudo-random-generator-next! can't return 0.0 (#803)
Browse files Browse the repository at this point in the history
According to the code of `S_random_state_next_double` at
https://github.com/cisco/ChezScheme/blob/1f5adec2c18712c89eb1692458fcf5d6514bff42/c/random.c#L108-L109
(which is invoked by `pseudo-random-generator-next!`),
the value is in the range (inclusively) 1 / (m1 + 1) to m1 / (m1 + 1).
Therefore, 0.0 cannot be the result.
  • Loading branch information
sorawee authored Feb 5, 2024
1 parent 1f5adec commit 02c79d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions csug/numeric.stex
Original file line number Diff line number Diff line change
Expand Up @@ -1506,8 +1506,8 @@ Checks whether \var{val} is a pseudo-random generator state.
provided, it must be a positive, exact integer.

Steps a pseudo-random generator to produce a number. The result is an
inexact number between \scheme{0.0} (inclusive) and \scheme{1.0}
(exclusive) if \var{below-int} is not provided. If \scheme{below-int} is
inexact number between \scheme{0.0} and \scheme{1.0}
(both exclusive) if \var{below-int} is not provided. If \scheme{below-int} is
provided, the result is an exact integer between \scheme{0} (inclusive)
and \scheme{below-int} (exclusive).

Expand Down

0 comments on commit 02c79d8

Please sign in to comment.