lib/games_dice/die.rb in games_dice-0.2.3 vs lib/games_dice/die.rb in games_dice-0.2.4
- old
+ new
@@ -53,11 +53,10 @@
end
# Calculates probability distribution for this die.
# @return [GamesDice::Probabilities] probability distribution of the die
def probabilities
- return @probabilities if @probabilities
- @probabilities = GamesDice::Probabilities.for_fair_die( @sides )
+ @probabilities ||= GamesDice::Probabilities.for_fair_die( @sides )
end
# Simulates rolling the die
# @return [Integer] selected value between 1 and #sides inclusive
def roll