weighted drunk


    Aug 13 2008 | 4:40 pm
    Hi,
    Is there any way to make [drunk] weighted? For example:
    Total range 1 to 4, but mostly outputs 1 and 2, occasionally wandering to 3 and 4.
    Here are two examples, though neither of them really get the job done how I'd like...

    • Aug 13 2008 | 5:11 pm
      Hi there,
      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.
      Cheers,
      Joel
    • Aug 13 2008 | 5:19 pm
      I think you could achieve this with itable/table. Take a look at Tutorial 17: Data Structures and Probability. Basically you can weight the probability of certain values occurring.
    • Aug 13 2008 | 5:33 pm
      Joel,
      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.
      Jay
    • Aug 13 2008 | 6:48 pm
      On Aug 13, 2008, at 9:40 AM, Jay Bodley wrote:
      > Is there any way to make [drunk] weighted?
      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
      still...):
      max v2;
      Chris Muir
      cbm@well.com
    • Aug 13 2008 | 6:57 pm
      Wow, Chris, thank you. This looks complicated (moreso than I thought it would be). I'll study it; I'm sure it helps out a lot.
    • Aug 13 2008 | 6:58 pm
      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...
      Good luck!
      -j
      ---------------------------------------------
      {
      "patcher" : {
      "fileversion" : 1,
      "rect" : [ 25.0, 69.0, 845.0, 778.0 ],
      "bglocked" : 0,
      "defrect" : [ 25.0, 69.0, 845.0, 778.0 ],
      "openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
      "openinpresentation" : 0,
      "default_fontsize" : 12.0,
      "default_fontface" : 0,
      "default_fontname" : "Arial",
      "gridonopen" : 0,
      "gridsize" : [ 15.0, 15.0 ],
      "gridsnaponopen" : 0,
      "toolbarvisible" : 1,
      "boxanimatetime" : 200,
      "imprint" : 0,
      "metadata" : [ ],
      "boxes" : [ {
      "box" : {
      "maxclass" : "comment",
      "text" : "4's",
      "fontname" : "Arial",
      "id" : "obj-137",
      "numinlets" : 1,
      "fontsize" : 12.0,
      "presentation_rect" : [ 381.0, 715.0, 0.0, 0.0 ],
      "numoutlets" : 0,
      "patching_rect" : [ 379.0, 710.0, 28.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "comment",
      "text" : "3's",
      "fontname" : "Arial",
      "id" : "obj-136",
      "numinlets" : 1,
      "fontsize" : 12.0,
      "presentation_rect" : [ 331.0, 713.0, 0.0, 0.0 ],
      "numoutlets" : 0,
      "patching_rect" : [ 329.0, 710.0, 28.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "comment",
      "text" : "2's",
      "fontname" : "Arial",
      "id" : "obj-135",
      "numinlets" : 1,
      "fontsize" : 12.0,
      "presentation_rect" : [ 271.0, 714.0, 0.0, 0.0 ],
      "numoutlets" : 0,
      "patching_rect" : [ 276.0, 710.0, 28.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "comment",
      "text" : "1's",
      "fontname" : "Arial",
      "id" : "obj-134",
      "numinlets" : 1,
      "fontsize" : 12.0,
      "numoutlets" : 0,
      "patching_rect" : [ 225.0, 710.0, 28.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "comment",
      "text" : "How many:",
      "fontname" : "Arial",
      "id" : "obj-133",
      "numinlets" : 1,
      "fontsize" : 12.0,
      "numoutlets" : 0,
      "patching_rect" : [ 147.0, 710.0, 75.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "button",
      "id" : "obj-132",
      "numinlets" : 1,
      "presentation_rect" : [ 476.0, 392.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "bang" ],
      "patching_rect" : [ 479.0, 385.0, 20.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "number",
      "fontname" : "Arial",
      "id" : "obj-131",
      "numinlets" : 1,
      "fontsize" : 12.0,
      "numoutlets" : 2,
      "outlettype" : [ "int", "bang" ],
      "patching_rect" : [ 479.0, 350.0, 50.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "4",
      "fontname" : "Arial",
      "id" : "obj-129",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 712.0, 219.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 722.0, 217.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "4",
      "fontname" : "Arial",
      "id" : "obj-130",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 688.0, 197.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 699.0, 197.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "3",
      "fontname" : "Arial",
      "id" : "obj-119",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 676.0, 220.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 676.0, 220.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "3",
      "fontname" : "Arial",
      "id" : "obj-120",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 653.0, 198.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 653.0, 197.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "2",
      "fontname" : "Arial",
      "id" : "obj-121",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 632.0, 220.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 632.0, 220.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "2",
      "fontname" : "Arial",
      "id" : "obj-122",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 608.0, 198.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 608.0, 197.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "2",
      "fontname" : "Arial",
      "id" : "obj-123",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 588.0, 220.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 588.0, 220.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "2",
      "fontname" : "Arial",
      "id" : "obj-124",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 564.0, 198.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 564.0, 198.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "2",
      "fontname" : "Arial",
      "id" : "obj-113",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 541.0, 221.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 541.0, 221.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "2",
      "fontname" : "Arial",
      "id" : "obj-114",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 518.0, 199.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 518.0, 199.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "2",
      "fontname" : "Arial",
      "id" : "obj-115",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 497.0, 221.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 497.0, 221.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "2",
      "fontname" : "Arial",
      "id" : "obj-116",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 473.0, 199.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 473.0, 199.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "1",
      "fontname" : "Arial",
      "id" : "obj-117",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 453.0, 221.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 450.0, 221.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "1",
      "fontname" : "Arial",
      "id" : "obj-118",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 429.0, 199.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 428.0, 199.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "1",
      "fontname" : "Arial",
      "id" : "obj-112",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 408.0, 221.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 405.0, 222.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "1",
      "fontname" : "Arial",
      "id" : "obj-111",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 386.0, 200.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 382.0, 200.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "1",
      "fontname" : "Arial",
      "id" : "obj-110",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 361.0, 220.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 361.0, 222.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "1",
      "fontname" : "Arial",
      "id" : "obj-109",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 339.0, 203.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 337.0, 200.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "1",
      "fontname" : "Arial",
      "id" : "obj-108",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 320.0, 222.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 317.0, 222.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "1",
      "fontname" : "Arial",
      "id" : "obj-107",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 293.0, 200.0, 32.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "newobj",
      "text" : "route 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19",
      "fontname" : "Arial",
      "id" : "obj-106",
      "numinlets" : 1,
      "fontsize" : 12.0,
      "numoutlets" : 21,
      "outlettype" : [ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" ],
      "patching_rect" : [ 292.0, 163.0, 494.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "toggle",
      "id" : "obj-103",
      "numinlets" : 1,
      "presentation_rect" : [ 421.0, 28.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "int" ],
      "patching_rect" : [ 421.0, 28.0, 20.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "newobj",
      "text" : "metro 500",
      "linecount" : 2,
      "fontname" : "Arial",
      "id" : "obj-104",
      "numinlets" : 2,
      "fontsize" : 11.595187,
      "presentation_rect" : [ 421.0, 54.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "bang" ],
      "patching_rect" : [ 421.0, 54.0, 54.0, 33.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "button",
      "id" : "obj-105",
      "numinlets" : 1,
      "presentation_rect" : [ 421.0, 93.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "bang" ],
      "patching_rect" : [ 421.0, 93.0, 20.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "newobj",
      "text" : "random 20",
      "fontname" : "Arial",
      "id" : "obj-102",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "numoutlets" : 1,
      "outlettype" : [ "int" ],
      "patching_rect" : [ 421.0, 125.0, 100.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "comment",
      "text" : "Method 2:",
      "fontname" : "Arial",
      "id" : "obj-101",
      "numinlets" : 1,
      "fontsize" : 12.0,
      "presentation_rect" : [ 337.0, 66.0, 0.0, 0.0 ],
      "numoutlets" : 0,
      "patching_rect" : [ 337.0, 66.0, 64.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "comment",
      "text" : " "linecount" : 2,
      "fontname" : "Arial",
      "id" : "obj-100",
      "numinlets" : 1,
      "fontsize" : 12.0,
      "numoutlets" : 0,
      "patching_rect" : [ 431.0, 489.0, 80.0, 34.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "comment",
      "text" : "Method 1:",
      "fontname" : "Arial",
      "id" : "obj-99",
      "numinlets" : 1,
      "fontsize" : 12.0,
      "numoutlets" : 0,
      "patching_rect" : [ 66.0, 69.0, 64.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "number",
      "fontname" : "Arial",
      "id" : "obj-97",
      "numinlets" : 1,
      "fontsize" : 12.0,
      "presentation_rect" : [ 555.0, 607.0, 0.0, 0.0 ],
      "numoutlets" : 2,
      "outlettype" : [ "int", "bang" ],
      "patching_rect" : [ 376.0, 688.0, 36.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "number",
      "fontname" : "Arial",
      "id" : "obj-96",
      "numinlets" : 1,
      "fontsize" : 12.0,
      "presentation_rect" : [ 511.0, 609.0, 0.0, 0.0 ],
      "numoutlets" : 2,
      "outlettype" : [ "int", "bang" ],
      "patching_rect" : [ 326.0, 688.0, 36.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "number",
      "fontname" : "Arial",
      "id" : "obj-95",
      "numinlets" : 1,
      "fontsize" : 12.0,
      "presentation_rect" : [ 458.0, 607.0, 0.0, 0.0 ],
      "numoutlets" : 2,
      "outlettype" : [ "int", "bang" ],
      "patching_rect" : [ 273.0, 688.0, 36.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "number",
      "fontname" : "Arial",
      "id" : "obj-94",
      "numinlets" : 1,
      "fontsize" : 12.0,
      "numoutlets" : 2,
      "outlettype" : [ "int", "bang" ],
      "patching_rect" : [ 222.0, 688.0, 36.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "newobj",
      "text" : "counter",
      "fontname" : "Arial",
      "id" : "obj-93",
      "numinlets" : 5,
      "fontsize" : 12.0,
      "presentation_rect" : [ 550.0, 492.0, 0.0, 0.0 ],
      "numoutlets" : 4,
      "outlettype" : [ "int", "", "", "int" ],
      "patching_rect" : [ 376.0, 632.0, 63.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "newobj",
      "text" : "counter",
      "fontname" : "Arial",
      "id" : "obj-92",
      "numinlets" : 5,
      "fontsize" : 12.0,
      "presentation_rect" : [ 508.0, 466.0, 0.0, 0.0 ],
      "numoutlets" : 4,
      "outlettype" : [ "int", "", "", "int" ],
      "patching_rect" : [ 328.0, 606.0, 63.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "newobj",
      "text" : "counter",
      "fontname" : "Arial",
      "id" : "obj-91",
      "numinlets" : 5,
      "fontsize" : 12.0,
      "presentation_rect" : [ 452.0, 436.0, 0.0, 0.0 ],
      "numoutlets" : 4,
      "outlettype" : [ "int", "", "", "int" ],
      "patching_rect" : [ 272.0, 576.0, 63.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "message",
      "text" : "0",
      "fontname" : "Arial",
      "id" : "obj-90",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "numoutlets" : 1,
      "outlettype" : [ "" ],
      "patching_rect" : [ 381.0, 498.0, 50.0, 18.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "newobj",
      "text" : "counter",
      "fontname" : "Arial",
      "id" : "obj-89",
      "numinlets" : 5,
      "fontsize" : 12.0,
      "numoutlets" : 4,
      "outlettype" : [ "int", "", "", "int" ],
      "patching_rect" : [ 227.0, 550.0, 63.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "newobj",
      "text" : "route 1 2 3 4",
      "fontname" : "Arial",
      "id" : "obj-88",
      "numinlets" : 1,
      "fontsize" : 12.0,
      "numoutlets" : 5,
      "outlettype" : [ "", "", "", "", "" ],
      "patching_rect" : [ 257.0, 498.0, 100.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "button",
      "id" : "obj-87",
      "numinlets" : 1,
      "numoutlets" : 1,
      "outlettype" : [ "bang" ],
      "patching_rect" : [ 142.0, 542.0, 20.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "button",
      "id" : "obj-80",
      "numinlets" : 1,
      "presentation_rect" : [ 290.0, 395.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "bang" ],
      "patching_rect" : [ 239.0, 389.0, 20.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "newobj",
      "text" : "+ 1",
      "fontname" : "Arial",
      "id" : "obj-81",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 291.0, 450.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "int" ],
      "patching_rect" : [ 239.0, 443.0, 34.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "newobj",
      "text" : "drunk 3",
      "fontname" : "Arial",
      "id" : "obj-82",
      "numinlets" : 3,
      "fontsize" : 12.0,
      "presentation_rect" : [ 291.0, 423.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "int" ],
      "patching_rect" : [ 239.0, 415.0, 56.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "newobj",
      "text" : "split 1 2",
      "fontname" : "Arial",
      "id" : "obj-85",
      "numinlets" : 3,
      "fontsize" : 12.0,
      "presentation_rect" : [ 234.0, 358.0, 0.0, 0.0 ],
      "numoutlets" : 2,
      "outlettype" : [ "int", "int" ],
      "patching_rect" : [ 199.0, 355.0, 59.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "button",
      "id" : "obj-79",
      "numinlets" : 1,
      "presentation_rect" : [ 198.0, 265.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "bang" ],
      "patching_rect" : [ 198.0, 265.0, 20.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "newobj",
      "text" : "+ 1",
      "fontname" : "Arial",
      "id" : "obj-77",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "presentation_rect" : [ 199.0, 327.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "int" ],
      "patching_rect" : [ 199.0, 320.0, 34.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "newobj",
      "text" : "drunk 3",
      "fontname" : "Arial",
      "id" : "obj-78",
      "numinlets" : 3,
      "fontsize" : 12.0,
      "presentation_rect" : [ 199.0, 293.0, 0.0, 0.0 ],
      "numoutlets" : 1,
      "outlettype" : [ "int" ],
      "patching_rect" : [ 199.0, 293.0, 56.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "number",
      "fontname" : "Arial",
      "id" : "obj-76",
      "numinlets" : 1,
      "fontsize" : 12.0,
      "numoutlets" : 2,
      "outlettype" : [ "int", "bang" ],
      "patching_rect" : [ 142.0, 514.0, 50.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "button",
      "id" : "obj-72",
      "numinlets" : 1,
      "numoutlets" : 1,
      "outlettype" : [ "bang" ],
      "patching_rect" : [ 121.0, 288.0, 20.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "number",
      "fontname" : "Arial",
      "id" : "obj-53",
      "numinlets" : 1,
      "fontsize" : 12.0,
      "numoutlets" : 2,
      "outlettype" : [ "int", "bang" ],
      "patching_rect" : [ 142.0, 288.0, 42.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "newobj",
      "text" : "split 1 2",
      "fontname" : "Arial",
      "id" : "obj-51",
      "numinlets" : 3,
      "fontsize" : 12.0,
      "numoutlets" : 2,
      "outlettype" : [ "int", "int" ],
      "patching_rect" : [ 142.0, 228.0, 59.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "newobj",
      "text" : "+ 1",
      "fontname" : "Arial",
      "id" : "obj-3",
      "numinlets" : 2,
      "fontsize" : 12.0,
      "numoutlets" : 1,
      "outlettype" : [ "int" ],
      "patching_rect" : [ 141.0, 196.0, 34.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "toggle",
      "id" : "obj-21",
      "numinlets" : 1,
      "numoutlets" : 1,
      "outlettype" : [ "int" ],
      "patching_rect" : [ 142.0, 37.0, 20.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "newobj",
      "text" : "metro 500",
      "linecount" : 2,
      "fontname" : "Arial",
      "id" : "obj-22",
      "numinlets" : 2,
      "fontsize" : 11.595187,
      "numoutlets" : 1,
      "outlettype" : [ "bang" ],
      "patching_rect" : [ 142.0, 63.0, 54.0, 33.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "button",
      "id" : "obj-31",
      "numinlets" : 1,
      "numoutlets" : 1,
      "outlettype" : [ "bang" ],
      "patching_rect" : [ 142.0, 102.0, 20.0, 20.0 ]
      }
      }
      , {
      "box" : {
      "maxclass" : "newobj",
      "text" : "drunk 3",
      "fontname" : "Arial",
      "id" : "obj-1",
      "numinlets" : 3,
      "fontsize" : 12.0,
      "numoutlets" : 1,
      "outlettype" : [ "int" ],
      "patching_rect" : [ 141.0, 162.0, 56.0, 20.0 ]
      }
      }
      ],
      "lines" : [ {
      "patchline" : {
      "source" : [ "obj-131", 0 ],
      "destination" : [ "obj-132", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-131", 0 ],
      "destination" : [ "obj-88", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-102", 0 ],
      "destination" : [ "obj-106", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-105", 0 ],
      "destination" : [ "obj-102", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-129", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-130", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-119", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-120", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-121", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-122", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-123", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-124", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-113", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-114", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-115", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-116", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-117", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-118", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-112", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-111", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-110", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-109", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-108", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-107", 0 ],
      "destination" : [ "obj-131", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 19 ],
      "destination" : [ "obj-129", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 18 ],
      "destination" : [ "obj-130", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 17 ],
      "destination" : [ "obj-119", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 16 ],
      "destination" : [ "obj-120", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 15 ],
      "destination" : [ "obj-121", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 14 ],
      "destination" : [ "obj-122", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 13 ],
      "destination" : [ "obj-123", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 12 ],
      "destination" : [ "obj-124", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 11 ],
      "destination" : [ "obj-113", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 10 ],
      "destination" : [ "obj-114", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 9 ],
      "destination" : [ "obj-115", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 8 ],
      "destination" : [ "obj-116", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 7 ],
      "destination" : [ "obj-117", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 6 ],
      "destination" : [ "obj-118", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 5 ],
      "destination" : [ "obj-112", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 4 ],
      "destination" : [ "obj-111", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 3 ],
      "destination" : [ "obj-110", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 2 ],
      "destination" : [ "obj-109", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 1 ],
      "destination" : [ "obj-108", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-106", 0 ],
      "destination" : [ "obj-107", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-104", 0 ],
      "destination" : [ "obj-105", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" : {
      "source" : [ "obj-103", 0 ],
      "destination" : [ "obj-104", 0 ],
      "hidden" : 0,
      "midpoints" : [ ]
      }
      }
      , {
      "patchline" :
    • Aug 13 2008 | 6:59 pm
      Woah...
      Why does my text look like that??? Weird... I think it works though.
    • Aug 13 2008 | 7:19 pm
      On Aug 13, 2008, at 11:59 AM, joelsquare wrote:
      > Why does my text look like that??? Weird... I think it works though.
      This is the "normal" Max 5 format. If you use Copy Compressed instead
      of Copy it gives you the forum-friendly compressed format.
      -C
      Chris Muir
      cbm@well.com
    • Aug 13 2008 | 8:34 pm
      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).
    • Aug 13 2008 | 9:10 pm
      How about 7 or 8 pints of Guinness?
      -A
    • Aug 13 2008 | 9:23 pm
      Quote: Andrew Pask wrote on Wed, 13 August 2008 22:10
      ----------------------------------------------------
      > How about 7 or 8 pints of Guinness?
      ----------------------------------------------------
      Well - that would weigh about 7 or 8 pounds, perhaps slightly more especially if you include the pint glass.
    • Aug 13 2008 | 9:29 pm
      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.
      -- Paul
      On Wed, Aug 13, 2008 at 3:34 PM, Martin Robinson <
      martinrobinson_mail@yahoo.co.uk> wrote:
      > 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
      >
      >
      >
      --
      ----- |(*,+,#,=)(#,=,*,+)(=,#,+,*)(+,*,=,#)| -----
    • Aug 14 2008 | 2:06 pm
      I've used this before in one of my patches. It was not created by me. It is credited to Bas van de Graaf in the patch. Weighted random thing.
    • Aug 15 2008 | 3:08 pm
      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
      precise.
      cheers,
      Carey
    • Aug 15 2008 | 7:55 pm
      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?-)
      Enjoy:
    • Aug 16 2008 | 9:34 pm
      Oops. My drunkex.maxpat had a major bug in the arithmetic so it was significantly different from drunk (rather than subtly different as the patch comment says).
      Fixed version attached.
      Quote: Peter Castine wrote on Fri, 15 August 2008 20:55
      ----------------------------------------------------
      > The proposed solutions based simply on [random] are mostly memory-free
      Of course [+] gives us the memory we need for this...
      And here's a weighted version too.
    • Aug 17 2008 | 11:49 am
      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).
      -- P.
    • Aug 17 2008 | 8:02 pm
      Yep, it was an approximated, moused-in set of values. And wasn't a direct solution to the original question.
      intriquing?
    • Aug 17 2008 | 9:26 pm
      Quote: martinrobinson wrote on Sun, 17 August 2008 22:02
      ----------------------------------------------------
      > intriquing?
      ----------------------------------------------------
      I need to get some sleep, or else there will be even more intriguing spelling misteaks. Probably medium-rare.