Note that there is currently an open issue (PR welcome) to have better random generator:
https://codeberg.org/guile/guile/issues/143 On Thu, 28 May 2026, Tim Meehan <[email protected]> wrote: > I wind up doing Monte-Carlo simulations a lot, and sometimes I do them in > Guile. Just feels more fun than Python or some other language sometimes. > > Once a language has a "uniform" generator (i.e., real numbers from 0 to 1) > it is pretty straightforward to give it a lot of other random generators. I > thought I saw a library somewhere that had a lot of them in Guile, but I > couldn't find it when you asked the question. I'd be happy to post all of > the ones I know how to do off of the top of my head somewhere, like on > Codeberg. I've been trying to move off of Github. > > > On Wed, May 27, 2026 at 6:49 PM Zelphir Kaltstahl < > [email protected]> wrote: > >> On 5/28/26 12:25 AM, Tim Meehan wrote: >> >> 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 AM Zelphir Kaltstahl < >> [email protected]> wrote: >> >>> 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 >> >> Damn, how did I not find that, when I had the need. Feeling a bit stupid >> now. Thanks for telling me. >> >> Just out of curiosity, how did you learn about that function existing? >> Just through procedure index of the manual and searching for "random" or >> "normal"? >> >> Best regards, >> Zelphir >> >> -- >> repositories: https://codeberg.org/ZelphirKaltstahl >> >> > -- Olivier Dion
