Last active
September 4, 2015 18:26
-
-
Save mscottford/365055 to your computer and use it in GitHub Desktop.
transformer_names.rb: Used to get a random Transformer character name. Great for naming devices.
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
class TransformerNames | |
# source: http://en.wikipedia.org/wiki/List_of_The_Transformers_characters#Autobots | |
AUTOBOTS = ['Teletraan', 'Optimus Prime', 'Wheeljack', 'Bumblebee', | |
'Cliffjumper', 'Prowl', 'Jazz', 'Sideswipe', 'Ratchet', 'Ironhide', 'Hound', | |
'Mirage', 'Trailbreaker', 'Sunstreaker', 'Bluestreak', 'Windcharger', | |
'Brawn', 'Huffer', 'Gears', 'Skyfire', 'Grimlock', 'Slag', 'Sludge', | |
'Snarl', 'Swoop', 'Warpath', 'Tracks', 'Grapple', 'Blaster', 'Red Alert', | |
'Smokescreen', 'Perceptor', 'Seaspray', 'Hoist', 'Powerglide', | |
'Beachcomber', 'Inferno', 'Cosmos', 'Omega Supreme', 'Devcon', 'Skids', | |
'Alana', 'Elita One', 'Chromia', 'Firestar', 'Moonracer', 'Alpha Trion', | |
'Silverbolt', 'Air Raid', 'Slingshot', 'Skydive', 'Fireflight', 'Superion', | |
'Streetwise', 'Groove', 'First Aid', 'Hot Spot', 'Blades', 'Defensor', | |
'Hot Rod', 'Kup', 'Ultra Magnus', 'Blurr', 'Springer', 'Arcee', 'Steeljaw', | |
'Ramhorn', 'Eject', 'Rewind', 'Wheelie', 'Rodimus Prime', 'Outback', | |
'Broadside', 'Pipes', 'Swerve', 'Tailgate', 'Metroplex', 'Sky Lynx', | |
'U-Haul Robot', 'Sandstorm', 'Beta', 'Nosecone', 'Lightspeed', 'Strafe', | |
'Scattershot', 'Afterburner', 'Computron', 'Chase', 'Freeway', 'Rollbar', | |
'Searchlight', 'Wideload', 'Goldbug', 'Punch-Counterpunch', 'Sureshot', | |
'Hardhead', 'Chromedome', 'Pointblank', 'Brainstorm', 'Highbrow', | |
'Cerebros', 'Crosshairs', 'Fastlane/Cloudraker', 'Fortress Maximus'] | |
# source: http://en.wikipedia.org/wiki/List_of_The_Transformers_characters#Decepticons | |
DECEPTICONS = ['Megatron', 'Skywarp', 'Starscream', 'Thundercracker', | |
'Soundwave', 'Laserbeak', 'Shockwave', 'Reflector', 'Rumble', 'Ravage', | |
'Frenzy', 'Shrapnel', 'Bombshell', 'Kickback', 'Hook', 'Scrapper', | |
'Bonecrusher', 'Long Haul', 'Scavenger', 'Mixmaster', 'Devastator', | |
'Buzzsaw', 'Thrust', 'Ramjet', 'Blitzwing', 'Dirge', 'Astrotrain', | |
'Deceptitran', 'Motormaster', 'Drag Strip', 'Dead End', 'Breakdown', | |
'Wildrider', 'Menasor', 'Brawl', 'Swindle', 'Blast Off', 'Vortex', | |
'Onslaught', 'Bruticus', 'Ratbat', 'Galvatron', 'Cyclonus', 'Scourge', | |
'Octane', 'Trypticon', 'Tantrum', 'Rampage', 'Headstrong', 'Razorclaw', | |
'Divebomb', 'Predaking', 'Runamuck', 'Runabout', 'Rippersnapper', 'Blot', | |
'Sinnertwin', 'Cutthroat', 'Hun-Grrr', 'Abominus', 'Slugfest', 'Overkill', | |
'Triggerhappy', 'Weirdwolf', 'Skullcruncher', 'Misfire', 'Mindwipe', | |
'Apeface', 'Snapdragon', 'Pounce/Wingspan', 'Sixshot', 'Slugslinger', | |
'Scorponok', 'Unicron'] | |
def self.random | |
all.sample | |
end | |
def self.random_autobot | |
AUTOBOTS.sample | |
end | |
def self.random_decepticon | |
DECEPTICONS.sample | |
end | |
def self.all | |
AUTOBOTS + DECEPTICONS | |
end | |
end | |
puts TransformerNames.random | |
puts TransformerNames.random_autobot | |
puts TransformerNames.random_decepticon |
Oh, I can't read. This was from 2 years ago.
@mscottford you should try Array#sample 👍
Fine! I just did. :)
No way! #random_element is where it's at! ;)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hah. Are you using ancient Rubies here? What about Array#sample.