ScreenCast 5: Web 2.0 Names

Published: March 28, 2007, 10:44 p.m.

This Rubyology screencast will focus on the Ruby random function and should serve as a refresher on arrays and hashes as well as looping. The source code to our example is provided below: # Rubyology Screencast - Web 2.0 Name Randomizer 10.times do letters = { ?v => 'aeiou', ?c => 'bcdfghjklmnpqrstvwxyz'} word = '' 'cvcvc'.each_byte do |x| source = letters[x] word << source[rand(source.length)].chr end puts word + '.com' end