Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Powershell Script:
- $Groups = Get-Content "C:\Scripts\Groups.txt"
- $Players = Get-Content "C:\Scripts\Players.txt"
- Clear-Variable -Name "PlayerGroups"
- $PlayerGroups = New-Object "System.Collections.Generic.Dictionary[String,String]"
- foreach($Player in $Players)
- {
- $RandomGroup = $Groups[(Get-Random -Maximum ([array]$Groups).count)]
- $PlayerGroups.Add("$player","$RandomGroup")
- }
- Write-Output $PlayerGroups | Sort-Object
- Output:
- Key Value
- --- -----
- PlayerA GroupB
- PlayerB GroupC
- PlayerC GroupA
- PlayerD GroupE
- PlayerE GroupE
- PlayerF GroupA
- PlayerG GroupB
- PlayerH GroupE
- PlayerI GroupB
- PlayerJ GroupB
- PlayerK GroupD
- PlayerL GroupE
- PlayerM GroupE
- PlayerN GroupD
- PlayerO GroupD
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement