logic's problem

    Feb 05 2009 | 1:07 am
    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?

    • Feb 05 2009 | 1:19 am
      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.
    • Feb 05 2009 | 1:33 am
      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!
    • Feb 05 2009 | 7:27 am
      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
    • Feb 05 2009 | 1:22 pm
      Or even use a coll filled with all possible combinations
    • Feb 05 2009 | 1:30 pm
      Sorry, too much cleaning up. this works hopefully :-)
    • Feb 05 2009 | 1:37 pm
      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!
    • Feb 06 2009 | 12:13 am
      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?