From: Robert Klemme Date: 2011-01-21T18:17:42+09:00 Subject: Re: Deleting from hashes On Fri, Jan 21, 2011 at 1:56 AM, Josh Rowe wrote: > Following on from my previous question > http://www.rubyforum.com/topic/912567#new > I need some help with deleting cards from a hash. Heres what I have > > #!/usr/bin/env ruby > Card = Struct.new :name, :type, :atk, :defn, :level > $deck = [ >  Card["Celtic Guardian", :monster, 1400, 1200,4], >  Card["Dark Magician", :monster, 2500, 2100,7], > ] > > def draw >  draw = rand(1) rand(1) won't work as intended, since you never get 1 as result. You would need at least rand(2) but even better use draw = rand($deck.size) otherwise the drawing won't work reliably once $deck has changed. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/