Skip to main content


Showing posts from April, 2022

A lunch roulette algorithm in R

The purpose of the algorithm described here is to randomly create pairs from a list of people to go out for lunch. As an input, this algorithm needs a list of people created as shown below and saved to a file called people.csv , in UTF-8 format. j,Jill Valentine,1 j,007,1 t,Tony Stark,2 d,Solid Snake,1 h,Hannibal Lecter,0 l,Lara Croft,2 d,Daenerys Targaryen,1 w,Heisenberg,1 Each line in this file should contain an email address, a name, and a code that should be set to 0, 1 or 2. Code 0 means ignored, so only people with codes 1 or 2 are considered when creating new pairs. In case of an odd number of people with codes 1 or 2, 1 randomly selected person with code 2 is discarded. In order to not have to worry about odd numbers, it is best to always have at least 1 person with code 2. Also important to