19
\$\begingroup\$

The challenge is simple:

generate a word.

Specifications:

  • Word must be pronounceable.
    • This is defined as "alternating between a consonant and a vowel."
    • A consonant is one of the following letters: bcdfghjklmnpqrstvwxz
    • A vowel is one of the following letters: aeiouy
  • Word must be randomly generated.
  • Words must be able to contain every consonant and vowel. (You can't just use bcdf for consonants and aei for vowels.)
  • Word must contain 10 letters.
  • Shortest code (in character count) wins.
\$\endgroup\$
9
  • 1
    \$\begingroup\$ codegolf.stackexchange.com/questions/11215/alien-name-generator \$\endgroup\$ Commented Jun 18, 2013 at 4:43
  • 8
    \$\begingroup\$ With this xkcd strip in mind, the program echo buxitiwymu technically conforms to the specification. I assure you, I generated the word randomly:P \$\endgroup\$ Commented Jun 23, 2013 at 22:02
  • 1
    \$\begingroup\$ @AardvarkSoup "Words must be able to contain every consonant and vowel" \$\endgroup\$
    – Doorknob
    Commented Jun 23, 2013 at 22:52
  • 1
    \$\begingroup\$ @Kartik depends on the context, in 'yes' it's a consonant, in 'why' it's a vowel, but this would make it impossible to define a pronounceable word as alternating between vowels and consonants, eg. yyyyyyyy would be a valid word. \$\endgroup\$ Commented Feb 17, 2015 at 22:30
  • 2
    \$\begingroup\$ I actually made a generator on Scratch a while back. It had specific rules for when you can treat y as a vowel, where you can use q and x, and when you can use two-letter combinations like ng or ea \$\endgroup\$ Commented Nov 6, 2016 at 21:42

36 Answers 36

1
2
1
\$\begingroup\$

Thunno 2 J, 9 bytes

5ıkykz,€ɼ

Try it online!

Explanation

5ıkykz,€ɼ  # Implicit input
5ı         # Repeat 5 times:
  ky  , ɼ  #  Random vowel
    kz €ɼ  #  Random consonant
           # Join into a string
           # Implicit output
\$\endgroup\$
1
\$\begingroup\$

Vyxal s, 8 bytes

k¹k∪"5ƈ∩

Try it Online!

    "    # Pair
k¹       # Consonants
  k∪     # And vowels
     5ƈ  # Choose 5 random items from each
       ∩ # Interleave
\$\endgroup\$
1
\$\begingroup\$

Ruby, 61 bytes

Port of l4m2's clever JavaScript solution; give them an upvote!

1until rand(9e99).to_s(36)=~/([^aeiouy\d][aeiouy]){5}/
puts$&

Attempt This Online!

\$\endgroup\$
0
\$\begingroup\$

Jelly, 13 bytes

Øy,ØYẊ€Zs5ḢŒl

Explanation:

Øy,ØYẊ€Zs5ḢŒl
Øy,ØY         Makes a list of two lists of characters: [[list-of-vowels-with-y], [list-of-consonants-without-y]]
     Ẋ€       Shuffle €ach.
       Z      Zip those two lists together. [[random-vowel, random-consonant],...]
        s5    Split them into chunks of five (because each pair contains two letters, this splits them into chunks of 10 letters)
          Ḣ   Take the list of 5 pairs.
           Œl Make each of the characters in it lowercase
              Implicit concatenation and print.

Try it online!

\$\endgroup\$
0
\$\begingroup\$

C (gcc), 63 bytes

c;f(n){for(n=10;n;81192%c-n&1||putchar(c,n--))c=97+clock()%26;}

Try it online!

\$\endgroup\$
0
\$\begingroup\$

Zsh --braceccl, 57 bytes

Try it Online!

shuf -n5 <(echo {bcdfghj-np-tvwxz}{aeiouy}|rs 0 1)|rs -g0

Alternates: 67b using jot ; 77b using arrays

\$\endgroup\$
1
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.