Re: Implementation of make-random-real-generator
Marc Nieper-WiÃkirchen 05 May 2020 18:59 UTC
Am Di., 5. Mai 2020 um 20:50 Uhr schrieb Arvydas Silanskas
<xxxxxx@gmail.com>:
>
> > if you're basing this SRFI on SRFI 27, why you decided to
> build your own rand-real-proc based on randomly generated integers
> rather than simply use random-real from SRFI 27
>
> The only reason is because it was defined for the generator to return lower and upper bounds inclusively, while the random real proc in srfi 27 returns 0 to 1 exclusively. I wasn't sure how to convert function with exclusive bound to inclusive except for reimplementing it grounds up.
Mathematically, the difference between including and excluding an
interval bound does not make any sense here. A set consisting of a
single real number has measure 0.
I understand that the real numbers of a programming language behave
differently (at least the inexact ones), but I wouldn't emphasize the
difference in the spec (and maybe leave it up to the implementation).
In any case, a program has to cope with real numbers arbitrarily close
to the upper bound, so it most likely has to be stable in the limit
case as well.
-- Marc