Module Random::Object
In: lib/more/facets/random.rb

Methods

maybe  

Public Instance methods

Random generator that returns true or false. Can also take a block that has a 50/50 chance to being executed.

  maybe  #=> true
  maybe  #=> false

[Source]

    # File lib/more/facets/random.rb, line 88
88:     def maybe(chance = 0.5, &block)
89:       if block then
90:         yield if rand < chance
91:       else
92:         rand < chance
93:       end
94:     end

[Validate]