Sha256: 184fb1c3b179c5bffc1f22ab560a5426b2f29dd6d59a10b7bac1334ad16b2711

Contents?: true

Size: 192 Bytes

Versions: 6

Compression:

Stored size: 192 Bytes

Contents

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
forgery-0.3.6 lib/forgery/extensions/range.rb
forgery-0.3.5 lib/forgery/extensions/range.rb
forgery-0.3.4 lib/forgery/extensions/range.rb
forgery-0.3.3 lib/forgery/extensions/range.rb
forgery-0.3.2 lib/forgery/extensions/range.rb
forgery-0.3.1 lib/forgery/extensions/range.rb