[CM] random stream with lists?
Rick Taube
taube@uiuc.edu
Wed, 24 Sep 2003 08:25:33 -0500
To generate lists as elements you need to use the "long specification"
form for
each item in the random pattern:
( datum [:weight n] [:min n] [:max n])
In your case each 'datum' will be a list, for example:
(new random :of '(
( (2 1 3) :weight 1)
( (2) :weight 1)
( (3 1) :weight 1)
( (1 2) :weight 1)
)
:for 3)
I included the :weight options in the example above so that you can see
the format of the specification. But of course ':weight 1' is also the
default value so you dont need to include these BUT you still need to
use the "long specification" form. The end result is that it looks
like each element is double list:
(new random :of '(
((2 1 3) )
((2) )
((3 1) )
((1 2) )
)
:for 3)
The reason you need the long form is so that the pattern can tell the
different between a list as an datumn and a list used as the "long
form" specification itself! I hope this is clear. The dictionary should
say somthing about this.
On Tuesday, Sep 23, 2003, at 07:43 America/Chicago, Orm Finnendahl
wrote:
> Hi,
>
> does anybody know of a straightforward way to do random streams with
> lists as elements in cm 2.4?
>
> This obviously doesn't work, but shows what I mean:
>
> (new random :of '((2 1 3) (2) (3 1) (1 2)) :for 3)
>
> -> ((2 1 3) (1 2) (2 1 3))
>
> I'd prefer not to use a random stream of numbers to reference the
> elements outside of the stream.
>
> --
> Orm
>
> _______________________________________________
> Cmdist mailing list
> Cmdist@ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist