Forums > MaxMSP

how to make a random pick from list ?

September 10, 2009 | 2:55 am

- I have 6 switches (on-off)(toggles for the moment);
- With some "if" objects, the combination of each(6) switch state (on or off) should generate a list of int (1 to 9) ;
- I want to randomly pick a number from that (dynamic) list(or message… I don’t know).

My questions :
- Witch object should i use to store that list ?
- Witch object(s) i need to pick an int from it ?



Ch
September 10, 2009 | 7:20 am

hi,

have a look to [zl lookup]

Ch


September 10, 2009 | 8:38 am

People used to use James McCartney’s alea object to do this.

The object was orphaned years ago, but lp.ale is a living reincarnation. Give it a list and it will choose one item at random.

Lp.ale is part of Litter Power and included in the free Litter Starter Pack. This runs on Max 5 (despite the Max Window’s complaints) but is happier on Max 4.

The version in Litter Pro will run on both Max 5 and Max 4.


September 10, 2009 | 2:25 pm

I just installed Litter Power on MAC with max5. It does not work.
I just installed Little Power on PC with max4.6. Some objects are still available but there is no object lp.ale.

Do someone have an other solution ?



Ch
September 10, 2009 | 3:00 pm

isn’t it what you’re looking for?

– Pasted Max Patch, click to expand. –

September 10, 2009 | 3:11 pm

Thanx everybody. I found how.
There it is….


September 10, 2009 | 3:15 pm

For the future…
I am really beginner and want to know :
What should I do when you send me TEXT MAX patcher like you did ?



Ch

September 10, 2009 | 7:53 pm
doubi73 wrote on Thu, 10 September 2009 16:25
I just installed Litter Power on MAC with max5. It does not work.

I just (re-)tested lp.ale 1.0 from Litter Power 1.7.1 (the current Starter Pack version) with Max 5.0.7. Works fine here (see screen shot–the .help file is also the Max 4 version, hence the wonky alignment after Max 5′s conversion).

Thank you for pointing out that lp.ale was inadvertently not included in the Windows distribution of the Starter Pack. This will be updated shortly.


September 10, 2009 | 8:42 pm

random and zl nth will do.


September 10, 2009 | 8:51 pm

this is actually an interesting way to select a random list element. I would have done this, but you do it with few objects.

– Pasted Max Patch, click to expand. –


Ch
September 10, 2009 | 9:25 pm

Did you have a look to what I posted?
quite the same Smile


September 11, 2009 | 12:33 am

I tried but…i have difficulties to copy and paste a patch.
I don’t know why.
I will ask a friend in montreal…to try with me.
tanx a lot Smile


September 11, 2009 | 3:11 pm

Just for the fun, you can also use the scramble mode of zl.

– Pasted Max Patch, click to expand. –

September 11, 2009 | 3:22 pm

WOW …less is more !
I will use your way !


September 27, 2009 | 11:46 am
Peter Castine wrote on Thu, 10 September 2009 10:38
People used to use James McCartney’s alea object to do this.

The object was orphaned years ago…

There was no alea object in James McCartney’s orphaned collection according to my copies of it. (Which for sure reincarnated in Super Collider…)

But there is a (still alive) alea object in the RTC library, basically the same as the other suggestions as abstraction.
My favorite is the zl scramble though, unless you need DOD certified randomness…

Stefan


September 27, 2009 | 9:44 pm

Thanks…finally i found this solution too….a zl scramble with a zl mth


September 8, 2013 | 3:42 pm

Resurrecting this post but how would I go about reversing this process? I am looking to take a list such as ’1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0′ and ‘mutate’ it slightly by changing a specified number of 0′s into 1′s at random without changing the existing 1′s. I’ve been going through the ZL help files but I can’t join the dots on how to achieve this. Any help would be much appreciated and even more appreciated if this was achievable with no externals… Thanks in advance!


Viewing 18 posts - 1 through 18 (of 18 total)