From: botp Date: 2010-09-07T09:21:56+09:00 Subject: Re: Dice Roller On Tue, Sep 7, 2010 at 8:01 AM, Hd Pwnz0r wrote: >puts "How many dice do you want to roll?" >roll = gets.chomp >num_rolls = roll num_rolls = gets.to_i >y = 0 >x = y.to_i + 1 x = 1 >while x <= roll.to_i while x <= num_rolls >puts "Roll " + x.to_s + ": " + rand(max=6).to_s puts "Roll #{x} : #{rand(max=6)+1}" x += 1 >end > > Also, is there a way for me to add one to the rand function so it won't > get a zero? cmon, a computer cannot add ;-) revised code below. DICE_SIDES=6 num_rolls = gets.to_i x=1 while x <= num_rolls puts "Roll #{x} : #{rand(DICE_SIDES)+1}" x+=1 end => Roll 1 : 3 Roll 2 : 1 Roll 3 : 6 Roll 4 : 2 Roll 5 : 3 Welcome to Ruby. Pls do not stop programming! best regards -botp