Generate a random number with 7 digits
It's an instance method:
puts Random.new.rand(1_000_000..10_000_000-1)
Take your base number, 1,000,000 and add a random number from 0 up to your max - starting number:
1_000_000 + Random.rand(10_000_000 - 1_000_000) #=> 3084592