Last active
May 22, 2018 14:09
ruby - Get random character except 'F' and 'T'
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/local/bin/ruby -w | |
| puts ( ['A'..'Z'].map(&:to_a) # create field with characters A-Z | |
| .flatten - ["F", "T"] # reduce nesting level and exclude 'F' and 'T' | |
| )[rand(23)] # take a random value from the remainung 24 letters |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment