We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Implementing a Secret Santa Program in Elixir
163
clicks
Source: 0x7f.dev
The author, Andrei C., expresses the common holiday frustration of gift exchanges leading to unnecessary spending and unwanted presents. To address this, he suggests a Secret Santa system and uses Elixir to create an algorithm that generates pairings for the gift exchange. The requirements for the algorithm are that it must create pairs, not match people with themselves, and ensure that pairs are not reciprocal. Andrei's initial idea to use a graph database was abandoned in favor of a simpler solution involving creating a list of people with their email addresses, shuffling the list, rotating it, and then pairing up the two resulting lists. For an odd number of participants, the issue of uneven matchups arises, but this is circumvented by rotating the list in such a manner that all participants can be paired. In addition, Andrei discovered Resend, an Elixir client for sending emails, and added a function to send out the Secret Santa matches via email. The post ends with an acknowledgment of the Elixir community's support over the past year, and an invitation for better algorithms, hinting at potential flaws in the proposed solution. Andrei also mentions he will be speaking at FOSDEM '24 in Brussels.
Related posts
© HashMerge 2024