Last active
May 22, 2018 14:09
-
-
Save amlang/65bc8856e9c7bbe16c762f5e79dc7616 to your computer and use it in GitHub Desktop.
ruby - Get random character except 'F' and 'T'
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
#!/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