Random lists with Zl Join

Jun 18, 2013 at 11:23am

Random lists with Zl Join

Hi, i’m trying to create a list of random numbers with Zl Join.
Theorically i must create a list with the last generate number and the list himself, and after that i probably need a “zl rev” to have the correct order.

The only thing is that i’m not really praticed with Zl and the output of zl is nothing, anyone can post an example of that, thanks?

#253131
Jun 18, 2013 at 11:34am

Do you want something like this:

<code>

– Pasted Max Patch, click to expand. –

</code>

???

#253137
Jun 18, 2013 at 11:40am

Nope, i don’t want to put an end to the list.
For example, i want to put a button before the random and every time i press it, another number join the list.

Also, i request the zl join because i want to learn better how it worked.

#253145
Jun 18, 2013 at 12:05pm

Aha! Like this, then:

<code>

– Pasted Max Patch, click to expand. –

</code>

#253150
Jun 18, 2013 at 12:13pm

Theorically yes, it’s similar to mine but…
It don’t work.
The message still empty, no matter how much times i press the button.

I use Max 5, it could be a problem?

#253152
Jun 18, 2013 at 12:14pm

Ok, probably the 5 don’t understand the [zl.join] but with the space instead of the dot it work.
Thanks! :)

#253155
Jun 18, 2013 at 1:47pm

Zl join is fine for joining lists, but I prefer zl group (with no arguments!!!) for making arbitrary lists. It’s a lot simpler:

Send whatever numbers/symbols you want, then send a bang to output the list.

Just be sure to not specify a list size as an argument.

<code>

– Pasted Max Patch, click to expand. –

</code>

#253167
Jun 18, 2013 at 1:55pm

Well, but with that isn’t also the list lenght at random every time i add a number?

The solution posted by Mzed is perfect for what i want.

Now, i’m continuing my work but i’ve got another number.

For example, you know the “Simon”, right? (It’s good for my example)
Suppose that i want to send the number to the corresponding led, and after the program read all the list, i must insert by pressing buttons (take 4 as example, just like Simon) the corresponding sequence (and return wrong when i made an error).

What i must use? I’ve read that probably Zl Nth could be useful, but personally i’ve never use that.

#253169
Jun 18, 2013 at 3:14pm

slightly ot now since i don’t know that Simon, sorry.
@Peter : i think the default max length will always be 512 elements though. To overcome this you must write e.g. [zl 4096 group].

Also without zl you can do this :
<code>

– Pasted Max Patch, click to expand. –

</code>

#253183
Jun 19, 2013 at 3:10am

There are a number of externals for randomizing lists(*). The original external doing this sort of thing, called [scramble], was written by James McCartney and hasn’t been supported for a long time. Litter Pro users will know lp.crabelms, and someone else has written a more recent list scrambler.


(*) As always, lists in Max must, technically, have an int or a float as the first item, otherwise you have a message followed by parameters and not a list. All of the list scramblers, however, conveniently treat messages as lists, just to make life easier.

Any object for randomizing (scrambling) lists will probably be the most straightforward way to get the results you want.

As for the [zl.join] syntax: introduced in Max 6. Previously there was one [zl] object, and one object only(*), for general-purpose list manipulation. You specified which type of manipulation with an argument ([zl join], [zl split], etc.). Since Max 6 there are lots of individual list-manipulation objects that, by a completely arbitrary convention adopted by Cycling ’74, all begin with “zl.” — I’m guessing that the idea was to provide the convenience of automatic object name completion.


Inserting a parody of the Lord of the Rings poem (“…one ring to join them all, and in the darkness bind them…”) is left as an exercise for the Reader so inclined.

#253228

You must be logged in to reply to this topic.