logic's problem

Feb 5, 2009 at 1:07am

logic's problem

Hi all,

I have two series of numbers (for example 0–>1000 and 0–>2000). I am trying to made a patch who can, for each bang, send a pair with one random number from each series. And each pair must not already have been used before.
I have try with a matrix (1 dimension for 1 serie) but after few minutes it’s began to be very slow. Does somebody have a idea?

Thanks,

p_yves

#42119
Feb 5, 2009 at 1:19am

Have a look at [urn], it is similar to the [random] object except that it remembers each number it generates and won’t repeat it.

lh

– Pasted Max Patch, click to expand. –
#150554
Feb 5, 2009 at 1:33am

yes i already try this way, but urn just can play one time each number.

if my two series are 123456789 and abcdefghi for example, i’m gonna have many pairs with each number or each letter.

1b
1e
1h

just the pairs must be unique!

#150555
Feb 5, 2009 at 7:27am

You could give each pair an index number and urn that. In your example there’s 81 possibilities. 81/9 (not /9.) gives the index of the one and 81%9 the index of the other series.

_
johan

#150556
Feb 5, 2009 at 1:22pm

Or even use a coll filled with all possible combinations

– Pasted Max Patch, click to expand. –
#150557
Feb 5, 2009 at 1:30pm

Sorry, too much cleaning up. this works hopefully :-)

– Pasted Max Patch, click to expand. –
#150558
Feb 5, 2009 at 1:37pm

You need to insert a [+ 1] after the [counter] or set the minimum because at the moment the first count is zero so the argument for [urn] is 15 when it should be 16. Apart from that: nice patch!

lh

#150559
Feb 6, 2009 at 12:13am

My aim is to recover progressively and randomly a picture, pixel by pixels.

So my two dimensions are actually closed to 2000 and 3000.

I need each pixel must be fill only on time.

Here is my first solution as a attached file.
In this patch i scan all the pixels of the matrix. If one pixel is empty (Alpha = 0), i fill it. If it’s full, the patch try the next one.
But this process began really slow after a while. Because the scan used the random objet i guess.

I am a beginner, maybe my patch is to complicate.

Thanks JKO for your patch. I have tryed to used two list 0 to 2000 and 0 to 3000 but it seems to be to much for the “combine” objet because max msp crash in this case.

Is there a big mistake in my patch?

#150560

You must be logged in to reply to this topic.