## compare 5 numbers

Sep 2, 2007 at 11:03am

# compare 5 numbers

Hi.
I?m using five random objects to create 5 numbers every 30000 millisecond
What i have difficulties figuring out is how to make a comparison if one number is equal to another number in the list. Or if several of the numbers is equal.
Any idea?
Thanks Richardo

#33506
Sep 2, 2007 at 11:38am

#111703
Sep 2, 2007 at 11:46am

if you want them all to be differnt you can use an urn object instead
of random, and have it do it every 6seconds instead, and have them
sent to something like pack with the last number sent going to the
first inlet, to dump the list at the end of 30sec, with no duplicates

max v2;
#N vpatcher 475 143 1198 640;
#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P message 269 291 50 196617 16 25 36 69 63;
#P window linecount 1;
#P newex 269 264 62 196617 prepend set;
#P newex 346 123 27 196617 + 1;
#P newex 269 175 66 196617 gate 5;
#N counter;
#X flags 0 0;
#P newobj 346 97 66 196617 counter;
#P toggle 270 45 15 0;
#P newex 270 69 64 196617 metro 6000;
#P newex 269 237 75 196617 pack 0 0 0 0 0;
#P newex 270 96 46 196617 urn 100;
#P connect 6 0 5 0;
#P connect 5 4 1 0;
#P connect 1 0 7 0;
#P connect 7 0 8 0;
#P connect 3 0 2 0;
#P connect 2 0 0 0;
#P connect 5 3 1 1;
#P connect 5 2 1 2;
#P connect 5 1 1 3;
#P connect 0 0 5 1;
#P connect 5 0 1 4;
#P connect 2 0 4 0;
#P connect 4 0 6 0;
#P pop;

On 9/2/07, Richardo del Pozo wrote:
>
> Hi.
> I?m using five random objects to create 5 numbers every 30000 millisecond
> What i have difficulties figuring out is how to make a comparison if one number is equal to another number in the list. Or if several of the numbers is equal.
> Any idea?
> Thanks Richardo
>
>

#111704
Sep 2, 2007 at 12:01pm

Thank you so much but I do not think i can use those methods.
I want it to generate 5 different numbers every 30000 millisecond between 1- 40.
these numbers will be unpacked and used to read images that has the corresponding number.

Example. if 2, 3, 33, and 12 is chosen it will display pictures 2, 3 33 and 12.
Therefor i cant have that to of the numbers are equal. Then it will fail to create five different images and displaying to, three, four or even five equal images.

i do not know if i explain it very well……
Sorry
Richardo

#111705
Sep 2, 2007 at 12:20pm

On 2 Sep 2007, at 13:01, Richardo del Pozo wrote:

> Thank you so much but I do not think i can use those methods.
> I want it to generate 5 different numbers every 30000 millisecond
> between 1- 40.

How about something like:

(i) generate number N1, between 1 and 40.
(ii) generate number N2, between 1 and 39. If N2 >= N1, N2 = N2 + 1
(iii) generalise. (Left as an exercise: this step is more complex
because you have more partitions.)

– N.

Nick Rothwell / Cassiel.com Limited
http://www.cassiel.com
http://www.myspace.com/cassieldotcom

#111706
Sep 2, 2007 at 12:21pm

the example i gave you would do just that, it would produce a list of
5 non-duplicate numbers every 30seconds

youd have to modify it a bit to make the counter reset, and to clear
the urn every so often

On 9/2/07, Richardo del Pozo wrote:
>
> Thank you so much but I do not think i can use those methods.
> I want it to generate 5 different numbers every 30000 millisecond between 1- 40.
> these numbers will be unpacked and used to read images that has the corresponding number.
>
> Example. if 2, 3, 33, and 12 is chosen it will display pictures 2, 3 33 and 12.
> Therefor i cant have that to of the numbers are equal. Then it will fail to create five different images and displaying to, three, four or even five equal images.
>
> i do not know if i explain it very well……
> Sorry
> Richardo
>

#111707
Sep 2, 2007 at 12:23pm

#111708
Sep 2, 2007 at 12:28pm

yes i figured it out after a bit, thank you very much guys.

#111709
Sep 4, 2007 at 12:04pm

Richardo del Pozo schrieb:
> Example. if 2, 3, 33, and 12 is chosen it will display pictures 2, 3
> 33 and 12. Therefor i cant have that to of the numbers are equal.
> Then it will fail to create five different images and displaying to,
> three, four or even five equal images.

this will go through all before it repeats an image…

Stefan

#P toggle 70 90 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 70 113 70 196617 metro 30000;
#P newex 114 229 37 196617 t clear;
#P newex 70 229 42 196617 zl group;
#P button 70 135 37 0;
#P newex 70 180 42 196617 uzi 5;
#P message 70 280 77 196617 31 2 36 16 15;
#P newex 70 253 62 196617 prepend set;
#P newex 70 206 54 196617 urn 40;
#P connect 7 0 4 0;
#P connect 8 0 7 0;
#P connect 0 1 6 0;
#P connect 4 0 3 0;
#P fasten 6 0 0 0 119 249 154 249 154 201 75 201;
#P connect 3 1 5 0;
#P connect 3 0 0 0;
#P connect 0 0 5 0;
#P connect 1 0 2 0;
#P connect 5 0 1 0;
#P window clipboard copycount 9;

Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#111710

You must be logged in to reply to this topic.