Created
November 18, 2013 21:33
-
-
Save obfusk/7535719 to your computer and use it in GitHub Desktop.
random line w/ ruby
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
ruby -e 'puts STDIN.lines.with_index.reduce(nil) { |x,(l,i)| rand(i+1) < 1 ? l : x }' <<< $'foo\nbar\nbaz' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment