Sha256: 15d4b06834a7b8681e217b76ed8aaf3ead894c00c3cc22785545a2e73a728f67

Contents?: true

Size: 195 Bytes

Versions: 2

Compression:

Stored size: 195 Bytes

Contents

class Range
  def random
    return nil unless self.max
    Integer(min) && Integer(max)
    Kernel.rand(self.max - self.min + 1) + self.min
  rescue ArgumentError
    self.to_a.random
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sevenwire-forgery-0.1.0 lib/extensions/range.rb
sevenwire-forgery-0.2.0 lib/extensions/range.rb