I can offer you a verbal description of what you might do...
Why don't you set it up so that 2 conditions need to be met in order for 3 & 4 to be output? So, if you have 2 drunk objects outputting numbers, and, as long as even one of them is 1 or 2, that's what the final output is. In order for 3 or 4 to be output, there needs to be two 3's or two 4's. Does that make sense? Essentially, if either of the drunk's creates a 1 or 2, then the final output is 1 or 2. If the first one creates a 3 or 4, MAX would then check the second drunk, and if THAT one ALSO has a 3 (or 4), then the output is 3 or 4. Otherwise, the output is a 1 or 2.
Does that make sense?
I'll move over to my other computer (which has MAX on it), and I'll see if I can create a patch that does this.
Yes, this makes sense, and it gives me something to work with. Your suggestion still allows for the possibility that both [drunk]s hang out around 3 and 4 for some amount of time outputting more of these numbers than I want. But I'll work with this and bring back any further questions.
I'm sure Peter Castine will opine on this, but here are a couple of
refinements of your approaches in the mean time. I also added a couple
of statistic visualizers (ok, ok, tables and multisliders, but
Here's a little patch that I made that contains two methods for achieving what you're talking about (I think).
The first example works by select 1-4. If a 1 or 2 is chosen, it passes through, if a 3 or 4 is chosen, it chooses again. Then, again, if a 1 or 2 is chosen, it goes through, but if a 3 or 4 is chosen, it choses again, and... once more, but this time, it will pass whatever is chosen. So, ergo... your chances of a 1 or 2 are higher than your chances of a 3 or 4. I used 'drunk' to generate numbers for this.
The second one is a bit clunkier, but it would allow for you to control probability of each of the numbers coming up. In the example, I've set it so that the chance of a 1 occurring is 2/5, the chance of a 2 occurring is also a 2/5, while the chances of a 3 occurring is 1/10, as is 4. I used 'random' to generate numbers for this, but drunk would work as well.
I also included a little counter at the bottom so you can see how many occurrences of each number there are.
I'm sure there are other ways to accomplish this, but here are a few...
This is not a direct solution to the question but a general way of reconstructing [drunk] by using [random] in a feedback loop. Once you have this you can then replace [random] with some weighted random choice (using one of the methods already mentioned e.g., table/itable).
By way of more general approaches to randomness, you might check out the
"chance" section of Karlheinz Essl's Real Time Composition Library
(RTC-lib). The "ratio" object does something like what you want, and there
are plenty of other interesting patches, all designed to work together.
On Wed, Aug 13, 2008 at 3:34 PM, Martin Robinson <
> This is not a direct solution to the question but a general way of
> reconstructing [drunk] by using [random] in a feedback loop. Once you have
> this you can then replace [random] with some weighted random choice (using
> one of the methods already mentioned e.g., table/itable).
> martin robinson
> max/msp java c
> installations/performance and systems
for larger arrays than 4 you might want to do a simple mapping... i
think someone mentioned table object. This is very simple to
impliment and adapt to various needs and wants. And you can be very
Quote: Chris Muir wrote on Wed, 13 August 2008 20:48
> I'm sure Peter Castine will opine on this,
That doesn't leave me much choice, does it?
[drunk] is supposed to be a kind of random walk or Brownian motion, and in the literature Brownian motion is always modeled as having equal probabilities for going "left" or "right" (or up/down). So it's not as if there are going to be ready-made solutions in Wikipedia's probability articles.
The proposed solutions based simply on [random] are mostly memory-free, and so they won't be Brownian. Period. For instance, Bas' generator is giving the product of two independent (approximately) uniform distributions. That's weighted, but not a random walk. Random walk is a Markov process with (at least) one order of memory.
In fact, the most direct way for Lao-Tze to get what he wants is a first-order Markov chain. You can use the stock [prob] object for that.
I don't usually post solutions that get by without Litter Power objects, but in this case I'll make an exception. However, if you are at all serious about randomness, you owe it to yourself to look at Litter Power, at the very least the Starter Pack (URI below). How can anyone calling himself Lao Tze can get by without an I Ching generator?-)
Quote: martinrobinson wrote on Sat, 16 August 2008 23:34
> Of course [+] gives us the memory we need for this...
Yep, feedback into the right inlet will do the trick.
> And here's a weighted version too.
Hmmm. What you're weighting is the step size, which is intriquing but different from what Lao-Tze asked for. He wanted the results to be weighted (specifically bottom-heavy). The result of your patch is an approximately symmetrical, approximately Brownian distribution. BTW, I'm not sure if you intended the itable contents to be assymetrical, but they are. So the expected mean is around 60, rather than 49.5 (which would be the case if the itable values were symmetrical). At the end of the day you're generating an approximately Gaussian distribution (more values in the middle than at either end, with a very slight shift upwards because of the asymmetry in the itable values).
I've attached Max 5 patch that shows a new approach to Lao-Tze's problem as well as the previous example. The new approach uses lp.pvvv~ from Litter Pro with a few daisy-chained split objects (rather like one of LT's early attempts but giving the results he wanted). It would be possible to substitute the lp.sss from the Litter Starter Pack (for those who are still just trying out Litter Power). However, you'd have to tweak the split boundaries a lot. Left as an exercise for the reader;-
What's more important in the attached is the example of lp.stacey to grab some statistical data from whatever your Random Number Generator is. The key values are mean, standard deviation, and skew (4th, 5th, 6th outlets).