Well, I don't see any reason to use a class for that. Maybe a module might be better?
Like:
module Die_Tumbler
def self.d20
val = 0
2.times do
x = rand(10) + 1
x += rand(10) if x == 10
val += x
end
return val
end
end
You could then run the method anytime with the code:
Die_Tumbler.d20
I am curious what you want to do with it though, since it is a very strange method. Anyway, the above code does what you apparently want to do.
Note, of course, that whenever you use it, it will rerun the method, not retain the first result. So, if you want to only do it once and operate on that result, you will need to save it to a variable.
P.S. why is your indenting so crazy? It makes it hard to read.