Sha256: 9818e4d38b4ad3f54a124c13992ca9b2c6d436a9b235324da64ef68838b84e85

Contents?: true

Size: 197 Bytes

Versions: 4

Compression:

Stored size: 197 Bytes

Contents

class Range
  def random
    Integer(first) && Integer(last)
    raise ArgumentError if first > last
    Kernel.rand(last - first + 1) + first
  rescue ArgumentError
    self.to_a.random
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
sevenwire-forgery-0.2.1 lib/extensions/range.rb
sevenwire-forgery-0.2.2 lib/extensions/range.rb
forgery-0.3.0 lib/forgery/extensions/range.rb
forgery-0.2.2 lib/extensions/range.rb