samedi 9 décembre 2017

Pick Random string from List

i am trying to write a program that would take in a list of string (this would be a list of name). Each string on the list would then pick another string from its own list. However, a criteria for this is that:

  1. Once a string has been selected, it should not be picked again. and;
  2. A specific string should not accept one or multiple string.

example, i have a set of name like below - or is List<string> ParticipantNames

James
John
Samantha
Rebecca
Tyrone
Tiffany

Each of them must pick from their own set of names, scenarios like below are examples:

James picked John - VALID
Samantha and Tyrone picked Rebecca - NOT VALID

And restrictions below may be applied: James must not be able to pick Tyrone and Tiffany Tiffany must not be able to pick John and Tyrone

So basically, the ideal pick would be like below

James -- Rebecca
John -- Tiffany
Samantha -- James
Rebecca -- Tyrone
Tyrone -- John
Tiffany -- Samantha

i do apologize if my explanation is off or confusing. but long story short, i need something that will randomly pick a string from its own set, avoid that string from being picked again, and have specific strings not picked by others.




Aucun commentaire:

Enregistrer un commentaire