Skip to content

Instantly share code, notes, and snippets.

@Plutor
Created March 21, 2011 18:47
Show Gist options
  • Save Plutor/879960 to your computer and use it in GitHub Desktop.
Save Plutor/879960 to your computer and use it in GitHub Desktop.
Script for establishing a random draft order for Fantasy Baseball 2011
#!/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