class PositionalGenerator::Builder::Int

def generate(_)

def generate(_)
  Faker::Base.rand(@ranges.sample(random: Faker::Config.random))
end

def initialize(length, ranges)

def initialize(length, ranges)
  # Internally we store only an Enumerable of Range values. So if we are
  # not given any Ranges but are given a length, we need to convert the
  # length to a Range.
  #
  # If the length is `5`, that means we should compute the Range `10000..99999`.
  # We can compute the lower end with a simple exponent: 10^4 = 10000.
  # The upper end is one less than an exponent: 10^5 - 1 = 99999.
  if ranges.nil?
    lower = 10**(length - 1)
    upper = (10**length) - 1
    ranges = [lower..upper]
  end
  @ranges = ranges
end