Class: Integer

Inherits:
Object
  • Object
show all
Defined in:
lib/graphics/extensions.rb

Overview

Integer extensions for graphics

Instance Method Summary collapse

Instance Method Details

#=~(n) ⇒ Object

Calculate a random chance using easy notation: 1 =~ 50

1 in 50 chance



8
9
10
# File 'lib/graphics/extensions.rb', line 8

def =~ n #
  rand(n) <= (self - 1)
end