class Ruboty::Roll::DiceSet

Attributes

count[R]
max[R]

Public Class Methods

new(count:, max:) click to toggle source
# File lib/ruboty/roll/dice_set.rb, line 9
def initialize(count:, max:)
  @count = count
  @max   = max
end

Public Instance Methods

roll() click to toggle source
# File lib/ruboty/roll/dice_set.rb, line 14
def roll
  # SecureRandom.random_number returns a value between 0 and argument - 1
  numbers = count.times.map{  SecureRandom.random_number(max) + 1 }
  Ruboty::Roll::Result.new(numbers)
end