Marketo Puzzle: Randomly Assigned "Lucky #"

Dan_Askin
Level 4

Marketo Puzzle: Randomly Assigned "Lucky #"

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?

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo Puzzle: Randomly Assigned "Lucky #"

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.