Created
July 5, 2013 10:59
-
-
Save mgechev/5933783 to your computer and use it in GitHub Desktop.
Random generator for the topics to re-study...
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 | |
| use warnings; | |
| use strict; | |
| use constant NUM_PER_DAY => 5; | |
| use constant TOTAL_TOPICS => 24; | |
| my @topics = (1..TOTAL_TOPICS); | |
| my ($rand, $temp); | |
| for (my $i = 0; $i < @topics; $i += 1) { | |
| $rand = int(rand($#topics) + 0.5); | |
| $temp = $topics[$rand]; | |
| $topics[$rand] = $topics[$i]; | |
| $topics[$i] = $temp; | |
| } | |
| $temp = 0; | |
| for (@topics) { | |
| print "---\n" unless $temp % NUM_PER_DAY; | |
| print "$_\n"; | |
| $temp++; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment