Creating lists of random numbers - why does urn not work?
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
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
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
You could also just send the list 1 2 3 4 5 6 7 ... 24 into zl.scramble.
Thanks! Nice to know there are several ways of doing this more elegantly.
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.
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.