Skip to content

Commit cf6b971

Browse files
random dice roll function working
1 parent 110db34 commit cf6b971

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

roller.rb

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def dice_roll(sides, num)
2+
3+
return rand(sides) * num
4+
5+
end
6+
7+
puts "Rolling 5 sided die"
8+
puts dice_roll(5,1)
9+
puts "Rolling 2 6 sided dice"
10+
puts dice_roll(6,2)

0 commit comments

Comments
 (0)