lib/games_dice.rb in games_dice-0.3.10 vs lib/games_dice.rb in games_dice-0.3.11
- old
+ new
@@ -24,8 +24,11 @@
# @param [#rand] prng Optional random number generator, default is to use Ruby's built-in #rand()
# @return [GamesDice::Dice] A new dice object.
#
def self.create dice_description, prng = nil
parsed = @@parser.parse( dice_description )
- GamesDice::Dice.new( parsed[:bunches], parsed[:offset], prng )
+ if prng
+ parsed[:bunches].each { |bunch| bunch.merge!( :prng => prng ) }
+ end
+ GamesDice::Dice.new( parsed[:bunches], parsed[:offset] )
end
end