From: "Jan E." Date: 2012-07-14T18:07:29+09:00 Subject: Re: learning by doing part 2 - tc game Sebastjan H. wrote in post #1068699: > I think random would be better if I add more beasts and spells in the > overall possible deck. First of all, you should change the structure of possible_cards to this: possible_cards = { :dragons => ["derimor", "barador", ...], :another_type => ["foo", "bar", ...], ... } So the types are the keys, and the corresponding names are the values. Then you can simply use Array#sample to select e. g. 4 dragons: deck_dragons = possible_cards[:dragons].sample 4 Your mistake was that you iterated over possible_cards for every selection. This would always give you the first dragon. And in the second example you forgot the "break", which would put *all* dragons into the deck for every selection. I've some other notes regarding the style, but I'll write that down in a second post ... -- Posted via http://www.ruby-forum.com/.