Created
March 21, 2011 18:47
-
-
Save Plutor/879960 to your computer and use it in GitHub Desktop.
Script for establishing a random draft order for Fantasy Baseball 2011
This file contains hidden or 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
#!/usr/bin/perl | |
@t=("D.J. Vajazzle", | |
"Tu Madre", | |
"Royal Rooters", | |
"The Darkhorse", | |
"The Mighty Hamsters", | |
"Amish Rake Fight", | |
"PhineusGageHeadaches", | |
"Misfit Chinese Food", | |
"Jeters Never Prosper", | |
"Zombie Slugga's", | |
"Sandwich Assassins", | |
"TBD"); | |
# Fisher-Yates shuffle | |
# <http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm> | |
my $i = @t; | |
while ($i--) { | |
my $j = int rand ($i+1); | |
@t[$i,$j] = @t[$j,$i]; | |
} | |
$i=1; | |
print map { $i++ . ") $_\n" } @t; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment