On Thu, Jul 12, 2018 at 4:15 PM, David Kastrup <d...@gnu.org> wrote:

> Karlin High <karlinh...@gmail.com> writes:
>
> > On 7/12/2018 1:17 PM, Freeman Gilmore wrote:
> >> I am using Frescobaldi and studying the Scheme Book.    When I compile,
> >>
> >> mylist = #( list 'red  random 12 )
> >> #(display mylist)
> >
> > If this is an exercise to demonstrate random numbers, I wonder if it
> > needs more parentheses.
> >
> > % CODE
> > \version "2.19.80"
> > mylist = #(list 'red (random 12))
> > #(display mylist)
> > % END CODE
> >
> > If I run it that way in Frescobaldi, it always returns: (red 3)
> >
> > If I use lilypond scheme-sandbox, I get things like this:
> >
> > guile> (list 'red (random 12))
> > (red 3)
> > guile> (list 'red (random 12))
> > (red 4)
>
> You could read the documentation for random.
>
>        Note that the initial value of ‘*random-state*’ is the same every
>     time Guile starts up.  Therefore, if you don’t pass a STATE parameter
> to
>     the above procedures, and you don’t set ‘*random-state*’ to
>     ‘(seed->random-state your-seed)’, where ‘your-seed’ is something that
>     _isn’t_ the same every time, you’ll get the same sequence of “random”
>     numbers on every run.
>
>        For example, unless the relevant source code has changed, ‘(map
>     random (cdr (iota 30)))’, if the first use of random numbers since
> Guile
>     started up, will always give:
>
>          (map random (cdr (iota 19)))
>          ⇒
>          (0 1 1 2 2 2 1 2 6 7 10 0 5 3 12 5 5 12)
>
>        To seed the random state in a sensible way for non-security-critical
>     applications, do this during initialization of your program:
>
>          (set! *random-state* (random-state-from-platform))
>
>
>
> --
> David Kastrup
>
​David:

​"random" has nothing to go with it, replace it with a different procedure
​I.e. "display" and it will do the same thing.

Thank you,ƒg
​
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to