Forums > MaxMSP

Creating lists of random numbers – why does urn not work?

June 24, 2013 | 6:04 pm

Hi,

I’m creating a list of 24 random numbers in a fairly standard way – by connecting an uzi 24 to random 24, then a +1 and then zl group 24 and routing this to unpack.

Can anyone tell me why connecting uzi 24 to urn 24 doesn’t work? It will run once, and then each subsequent time I send a bang to the uzi it won’t work. Using random instead of urn allows me to keep generating lists of random numbers – but I need unique numbers, not random numbers. And I need to be able to reset them.

Thanks!
iriXx


June 24, 2013 | 6:58 pm

Hi,

urn must be resetted everytime it’s out of values. Use the second outlet to send a "clear" message followed by a bang. See attached patched.

D

Attachments:
  1. urn_reset.maxpat

June 24, 2013 | 7:36 pm

Thank you! Actually I emailed a friend as I needed a solution quickly and he said exactly the same thing – urn needs a clear and I also need to send a zlclear.

Thanks for the patch!

-iriXx


June 24, 2013 | 7:52 pm

You could also just send the list 1 2 3 4 5 6 7 … 24 into zl.scramble.


June 25, 2013 | 12:04 am

Thanks! Nice to know there are several ways of doing this more elegantly.


June 25, 2013 | 11:26 am

Hi IriXx — aside from the reset thing with urn, note that it is possible to get a repeat at the reset (the last value from the previous series of 24 may be the same as the first value from the new series). There are numerous threads on the list on avoiding this (if it’s an issue for you). And if all you want is to avoid immediate repetitions, there are other ways of doing this (but from what you’ve written I suspect you want different permutations of your 24 values).

I would have used lp.ernie, which automatically refills itself when it goes empty (Litter Power), or lp.crabelms. Plenty of ways to skin this cat.


June 25, 2013 | 4:03 pm

Thanks Peter – that is handy to know for future too. Yes I do just want different permutations for the purposes of this project. I did try searching but evidently didn’t have the right terms to describe the issue I’d been having.

Haven’t explored lp yet – as you may have gathered I’m fairly new to Max.


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