Created
October 11, 2012 05:39
-
-
Save sandbochs/3870423 to your computer and use it in GitHub Desktop.
Random MOTD
This file contains 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
def random_motd | |
file_reader = File.new("motd_list.txt", "r") | |
count = 0 | |
file_reader.each do |line| | |
count += 1 | |
if Random.rand(count) == 0 | |
motd = file_reader.readline | |
end | |
end | |
motd | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment