You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Random numbers in Scheme are only random if you initialize them to some "outside" value, e.g. the current time. This has been discussed just a few days ago: https://lists.gnu.org/archive/html/lilypond-user/2020-01/msg00496.html
Probably I should do so in the example because otherwise there's no practical use for the function.
I read but it did not help. I tried using this (set! random-state (random-state-from-platform)) in a couple of places. I got 61 or nothing
Well, it seems David's explanation was less useful than I thought.
I don't know what random-state-from-platform is, and I get an error from this.
While this isn't really documented (shame on Guile!) it seems seed->random-state expects a string but auto-converts numbers to that. So it is possible to use one of the parts of the current time pair to seed the random state and get a different number in every run.
I think this should be described somewhere. Maybe a section with "various topics"?
The text was updated successfully, but these errors were encountered:
From a private discussion:
Well, it seems David's explanation was less useful than I thought.
I don't know what
random-state-from-platform
is, and I get an error from this.The full documentation is at https://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/Random.html#Random, and there you can find the explanation and an example for
seed->random-state
which David referenced.You need to call that procedure with "something that isn't the same every time", for example with
While this isn't really documented (shame on Guile!) it seems
seed->random-state
expects a string but auto-converts numbers to that. So it is possible to use one of the parts of the current time pair to seed the random state and get a different number in every run.I think this should be described somewhere. Maybe a section with "various topics"?
The text was updated successfully, but these errors were encountered: