// Allows a user to determine how many dice are being rolled and how many sides the dice have then totals the results. This was designed for my personal use with Dungeons and Dragons since I do not own any physical dice. Feel free to use this code and improve upon it. Any suggestions are more than welcome. I am a Ruby novice.
puts "How many dice are you rolling? " dice = gets.chomp puts "How many sides does each die have? " sides = gets.chomp x = 0 y = dice.to_i while x < y result = result.to_i + rand(sides.to_i) + 1 x = x + 1 end puts "The number you rolled is " + result.to_s gets