Re: RNGs in Guile

Zelphir Kaltstahl <[email protected]> Wed, 27 May 2026 12:11:36 +0000
Newsgroups gmane.lisp.guile.user
Message-ID <[email protected]>
On 5/27/26 7:19 AM, λx.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 about 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 are 
generated there, but the code sucks so hard, it is also impenetrable for someone 
not knowing the mathematical formula it tried to express and understanding 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 it 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