Need help with very basic probability solving

animalfarm's icon

Hello

I'm pretty new to max and programming in general, so please be kind :-)

I currently just can't get my head around this very basic probability problem:

- I have a message box with (a,b,c,d,e)
- I have a message box with (0.2, 0.3, 1.0, 0.9, 0.6)

What I'm trying to achieve:
With every count, I receive an output that gives me value (a) with probability (0.2). With probability (0.8), any of the other letters should be appear. There chance should be equally distributed; that is, (b), (c), (d) or (e) should appear with probability (0.2) each.

The same process should apply to all other letters in the message box!

I tried searching the forum, and I guess its something with coll and/or table, but I'm just a bit overwhelmed of there functionality at the moment, a small starter would certainly help me out!

Max Patch
Copy patch and select New From Clipboard in Max.

evanlivingston's icon

Sorry, could you rephrase your question. Perhaps say a little more clearly what you would like to achieve with this. There are many many ways of dealing with probability and another technique might be better suited to your project.

Are you trying to have a letter outputted, and also calculate probability of that letter being outputted? Or are you trying to output a letter based on it's probability?

Chris Muir's icon
Max Patch
Copy patch and select New From Clipboard in Max.

There are a lot of ways to do this sort of thing in Max. Here's one of them:

evanlivingston's icon

Chris, I've always been curious about this technique in Max Msp. Doesn't an itable allow for sums of probabilities to be over 1 or 100%. However I see that C has a value of 1 yet is not selected every time. I'm confused.

Christopher Dobrian's icon

Sending a 'bang' to a table (or itable) is equivalent to sending a 'quantile' message with a random number less than 32,768 as its argument. Here's the description of 'quantile'.

quantile     Multiplies the incoming number by the sum of all the numbers in the table. This result is then divided by 2^15 (32,768). Then, table sends out the address at which the sum of all values up to that address is greater than or equal to the result.

Max Patch
Copy patch and select New From Clipboard in Max.

It's a way of making a probabilistic choice regardless of the sum of all the probabilities.

Roman Thilenius's icon

[110.probaswitch]