Re: RNGs in Guile

Tim Meehan <[email protected]> Wed, 27 May 2026 17:25:20 -0500
Newsgroups gmane.lisp.guile.user
Message-ID <CACgrOxLOWmEoTbYdFALoSpPji5V3EMv=3a8mWAgbAzAgy0RwYg@mail.gmail.com>
I think that (ice-9 random) has (random:normal). That would generate a
Gaussian random variate with mean zero and standard deviation 1.

On Wed, May 27, 2026 at 7:12=E2=80=AFAM Zelphir Kaltstahl <
[email protected]> wrote:

> On 5/27/26 7:19 AM, =CE=BBx.x wrote:
> > this is somewhat tangential; i am not necessarily talking of hashing,
> but more
> > cryptographic functions shipped with Guile as a whole.
> >
> > if Guile is going to ship with a cryptographic hash function, what abou=
t
> other
> > cryptographic functions?  Are we satisfied with the RNG interfaces
> provided in
> > core and SRFI 27?  whether they RNGs provided are cryptographically
> secure
> > does not seem to be documented in the manual, at least not explicitly.
>
> What I found lacking are functions normal/Gaussian distributed random
> number
> generation. Last time I checked there was no such thing. Generating a
> normal
> distribution from uniform distributions can be mathematically quite
> challenging.
> So many algorithms for approximation, and many of them requiring deep
> mathematical understanding to understand when one such algorithm would
> yield
> good enough results and when not, and what parameters to tweak to make it
> suitable and so on and on. Or blindly copying without understanding and
> just
> praying. Not very keen on having to improvise something like that, with
> limited
> mathematical understanding and Wikipedia being an impenetrable wall of
> math for
> such algorithms.
>
> I went as far as checking NumPy, how normal distributed random numbers ar=
e
> generated there, but the code sucks so hard, it is also impenetrable for
> someone
> not knowing the mathematical formula it tried to express and understandin=
g
> that
> in turn. One letter variables or abbreviations everywhere, that no one
> other
> than mathematicians will be able to interpret, with no regard for
> readability at
> all. Just like what one would expect a mathematician without any software
> development experience to write : )
>
> Having a good (and readable! perhaps with references!) algorithm for that
> in the
> standard library, or in a supported SRFI, or as an extension to a
> supported
> SRFI, would be great. And the docs should of course state what purposes i=
t
> is
> useful for and whether it is cryptographically secure or not.
>
> Not that Python necessarily is the yardstick for all the things, but here
> is its
> standard library:
> https://docs.python.org/3/library/random.html#random.gauss.
>
> Best regards,
> Zelphir
>
> --
> repositories: https://codeberg.org/ZelphirKaltstahl
>
>
>