Created
June 11, 2021 13:24
-
-
Save BlythMeister/bf1a5e4b12d89fae3b1fe7e656955a61 to your computer and use it in GitHub Desktop.
Sweepstake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var teams = File.ReadAllLines(@"C:\users\chris.blyth\Desktop\Teams.txt").ToList(); | |
var people = File.ReadAllLines(@"C:\users\chris.blyth\Desktop\People.txt").ToList(); | |
if (teams.Count > people.Count) | |
{ | |
var missingPeople = teams.Count - people.Count; | |
for (int i = 0; i < missingPeople; i++) | |
{ | |
people.Add($"Extra {i + 1}"); | |
} | |
} | |
var random = new Random(); | |
var max = teams.Count; | |
for (int i = 0; i < max; i++) | |
{ | |
var nextRandomTeam = random.Next(0, teams.Count); | |
var team = teams[nextRandomTeam]; | |
var nextRandomPerson = random.Next(0, people.Count); | |
var person = people[nextRandomPerson]; | |
Console.WriteLine($"{person} - {team}"); | |
teams.RemoveAt(nextRandomTeam); | |
people.RemoveAt(nextRandomPerson); | |
Thread.Sleep(1000); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment