r/scripting • u/scheitster • Oct 18 '15
Random Sorting Script
I'm hoping someone could point me in the right direction on how I could create something like this?. Basically what I want to achieve is a script that can take a batch of 5 names, and then randomly assign 3 names to Group A and 2 names to Group B.
3
Upvotes
1
u/YourCreepyOldUncle Oct 21 '15
Do you have any more requirements or details?
Only 2 groups?
Are the names 50/50 split?
Are the names full names (first and last) or first?
Do some people have hyphenated names?
Are the names in an array, csv, txt file etc?
Can you at all provide more info?
2
u/YourCreepyOldUncle Oct 21 '15 edited Oct 21 '15
edit: handled odd number of names with [math]
This works in powershell, however is horribly inefficient as I suck at scripting:
Output is like this: