Help to create Macro for Secret Santa

Hello, I want to create a Macro for the Americans "Secret Santa".

I have a dictionary with the names and telephone numbers of the participants, I need to draw the names at random and at the end of the draw send an SMS to each participant informing them who their "Secret Friend" is.

Can anyone help me with the logic of the draw?
 

Dm114

Well-known member
Hello, I want to create a Macro for the Americans "Secret Santa".

I have a dictionary with the names and telephone numbers of the participants, I need to draw the names at random and at the end of the draw send an SMS to each participant informing them who their "Secret Friend" is.

Can anyone help me with the logic of the draw?
First of all I would suggest to convert your dictionary to an array of this form:
• indexes from 0 to n
• element values of this form: phone#→name of the participant

Then make a "m" times loop ("m" is the number of SMS you want to send.
Get a random number from 0 to n and extract the corresponding phone# and name (after the special character "→")

To avoid sending multiple messages to the same phone# (in case same random number comes) you can use several possibilities, such as generating a string variable with all potential array indexes (of the form "000,001, ... ,nnn,"), get corresponding index from this string then erase the used index "nnn," from the string and continue looping with random number from 0 to ((strlen=string_var)/4)-1
 
Top