Hi, Im trying to find an object that will do a random set number - eg. 20 to 100 without repeating the same number twice. Any clues?
Thanks, Timon.
I read:
Im trying to find an object that will do a random set number - eg. 20 to 100 without repeating the same number twice. Any clues?
try maxlib's [um] http://www.akustische-kunst.de/puredata/maxlib/index.html
lg
x
I read:
Im trying to find an object that will do a random set number - eg. 20 to 100 without repeating the same number twice. Any clues?
sorry, that is of course [urn] and it's also in cyclone.
as in:
[bang ( | [urn 80] | [+ 20] | [s here-we-go]
regards,
x
On Mon, 10 May 2004 23:33:57 +0200 (CEST) someone called CK wrote:
I read:
Im trying to find an object that will do a random set number - eg. 20 to 100 without repeating the same number twice. Any clues?
sorry, that is of course [urn] and it's also in cyclone.
or "shuffle" which is part of motex (http://www.reverberant.com/PD/index.htm).
m
Hallo, timon botez hat gesagt: // timon botez wrote:
Im trying to find an object that will do a random set number - eg. 20 to 100 without repeating the same number twice. Any clues?
This is Mathieu's elegant solution from the archives at http://iem.kug.ac.at/mailinglists/pd-list/2002-11/011117.html
If you want sequences of five different numbers from 0 to 4, then you can start with the list "0 1 2 3 4", pick a random valid position in that list and remove the number at that position. That gives you equal access to the 5*4*3*2*1=120 possibilities.
If instead you just want that two consecutive numbers never be the same; then you always keep the previous number (P), and you use 4 as the range, you pick a single random number (R), and you compute R+(R>=P). The trick is that >= is an indicatrix, which means it's worth 1 if the condition is true, and 0 if it's false; and adding that indicatrix to the number itself will cause the previous number to be skipped as a possibility.
e.g. P=2, R's might be 0,1,2,3, then R>=P might be 0,0,1,1, then R+(R>=P) might be 0,1,3,4, and there you go, 2 is skipped.
You will also need the [t] object to route R into >= before +.
Attached is a realization of the second idea as an abstraction.
Frank Barknecht _ ______footils.org__