class RandomPointGenerator
Public Class Methods
new(sw_point = nil, ne_point = nil)
click to toggle source
# File lib/random_point_generator.rb, line 2 def initialize(sw_point = nil, ne_point = nil) sw_point ||= [-90.0, -180.0] ne_point ||= [90.0, 180.0] @sw_point = sw_point @ne_point = ne_point end
Public Instance Methods
random_point()
click to toggle source
# File lib/random_point_generator.rb, line 10 def random_point y_range = (sw_lat .. ne_lat) x_range = (sw_lng .. ne_lng) [rand(y_range), rand(x_range)] end
Private Instance Methods
ne_lat()
click to toggle source
# File lib/random_point_generator.rb, line 26 def ne_lat @ne_point[0] end
ne_lng()
click to toggle source
# File lib/random_point_generator.rb, line 30 def ne_lng @ne_point[1] end
sw_lat()
click to toggle source
# File lib/random_point_generator.rb, line 18 def sw_lat @sw_point[0] end
sw_lng()
click to toggle source
# File lib/random_point_generator.rb, line 22 def sw_lng @sw_point[1] end