1 Reply Latest reply on May 3, 2017 6:51 PM by Sanford Whiteman

    Marketo Puzzle: Randomly Assigned "Lucky #"

    Dan Askin

      We're bouncing around a ETW lottery idea. Concept is fairly simple:


      Person enters contest.

      Person gets a randomly assigned lucky # within a range, 00001 and 99999

      No number within the range can be distributed more than once

      We email entrants with their randomly assigned lucky #


      Is this possible within Marketo?

        • Re: Marketo Puzzle: Randomly Assigned "Lucky #"
          Sanford Whiteman

          For the lurkers: Dan asked me about this offline as well (we've worked together on such things before). The answer I gave is...


          It's not possible within Marketo, but easy with FlowBoost. 3 lines of code:


          var allLuckies = new Array(100000).fill().map( (itm,idx) => idx ),
              contest19 = FBRandom.getSequence().seed(19),
              myLuckyNumber = FBRandom.shuffle( contest19, allLuckies )[{{lead.Id}}];


          The number 19 here is just an arbitrary # you assign to the contest. You can have an unlimited number of contests over time, and a lead will have a different lucky number in each contest (and of course unique within the contest).


          N.B. For reasons that will be apparent after some ruminatin', you need more than 6 digits' worth of codes if your Marketo database is bigger than 6 digits, i.e. if you have a million contacts do new Array(1000000).


          Since this is such a straightforward use for FB, I'll blog about how it works this weekend.

          2 of 2 people found this helpful