class Fixnum def d(y) self.times.map{rand(y)+1}.reduce :+ endend puts "2d6 #{2.d 6}"
Standard input is empty
2d6 8
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!