Created
February 7, 2013 03:53
-
-
Save kenn/4728296 to your computer and use it in GitHub Desktop.
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
require 'securerandom' | |
module Syllable | |
CONSONANT = %w(b c d f g h j k l m n p qu r s t v w x z ch cr fr nd ng nk nt ph pr rd sh sl sp st th tr lt) | |
VOWEL = %w(a e i o u y) | |
def generate(size=2) | |
"".tap do |result| | |
(size * 2).times do |i| | |
result << (i.even? ? CONSONANT[SecureRandom.random_number * CONSONANT.size] : VOWEL[SecureRandom.random_number * VOWEL.size]) | |
end | |
end | |
end | |
module_function :generate | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment