Forums > MaxMSP

while loop

February 20, 2007 | 8:56 pm

im trying to create a while loop in max so that a number of different random number generators do not create the same number. I know about using the == and != math functions but cant create a loop that works any ideas?? cheers


February 20, 2007 | 9:20 pm

You can do it with either == or !== like this:

#P button 185 219 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 47 274 58 196617 print same;
#P newex 185 296 62 196617 print result;
#P toggle 121 73 15 0;
#P newex 121 98 58 196617 metro 300;
#P newex 185 241 27 196617 i;
#P newex 185 267 48 196617 pack 0 0;
#P newex 121 219 32 196617 sel 1;
#P newex 121 192 67 196617 ==;
#P newex 178 157 52 196617 random 4;
#P newex 121 125 30 196617 t b b;
#P newex 121 157 52 196617 random 4;
#P fasten 4 1 11 0 148 240 166 240 166 214 190 214;
#P connect 11 0 6 0;
#P fasten 4 0 10 0 126 261 52 261;
#P fasten 4 0 0 0 126 245 114 245 114 152 126 152;
#P connect 5 0 9 0;
#P connect 8 0 7 0;
#P connect 7 0 1 0;
#P connect 0 0 3 0;
#P fasten 0 0 6 1 126 180 207 180;
#P connect 6 0 5 0;
#P connect 2 0 3 1;
#P fasten 2 0 5 1 183 183 228 183;
#P connect 3 0 4 0;
#P fasten 1 1 2 0 146 149 183 149;
#P connect 1 0 0 0;
#P window clipboard copycount 12;


February 21, 2007 | 10:36 am

On 20 Feb 2007, at 20:56, sean doyle wrote:

> im trying to create a while loop in max so that a number of
> different random number generators do not create the same number.

If they’re being constrained to not generate the same number, then
they’re not random. In any case, avoiding collisions by iteration is
a bit untidy. How exactly do you want the (non-random) generators to
behave?

– N.


February 21, 2007 | 8:56 pm

isnt that what urn is for?


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