class Rollr::Die
Constants
- ZERO_INDEX_FIXER
Attributes
randomizer[RW]
sides[RW]
Public Class Methods
new(sides, randomizer: SecureRandom)
click to toggle source
# File lib/rollr/die.rb, line 8 def initialize(sides, randomizer: SecureRandom) @sides = sides @randomizer = randomizer end
Public Instance Methods
roll(quantity = 1)
click to toggle source
# File lib/rollr/die.rb, line 13 def roll(quantity = 1) Rollr::RollReport.new( Rollr::Roll.new( quantity: quantity, die: self ) ) end
simple_roll()
click to toggle source
# File lib/rollr/die.rb, line 22 def simple_roll randomizer.random_number(sides).to_i + ZERO_INDEX_FIXER end