Class: RandomPointGenerator
- Inherits:
-
Object
- Object
- RandomPointGenerator
- Defined in:
- lib/random_point_generator.rb
Instance Method Summary collapse
-
#initialize(sw_point = [-90.0, -180.0], ne_point = [90.0, 180.0]) ⇒ RandomPointGenerator
constructor
A new instance of RandomPointGenerator.
- #random_point ⇒ Object
Constructor Details
#initialize(sw_point = [-90.0, -180.0], ne_point = [90.0, 180.0]) ⇒ RandomPointGenerator
Returns a new instance of RandomPointGenerator.
2 3 4 5 |
# File 'lib/random_point_generator.rb', line 2 def initialize(sw_point = [-90.0, -180.0], ne_point = [90.0, 180.0]) @sw_point = sw_point @ne_point = ne_point end |
Instance Method Details
#random_point ⇒ Object
7 8 9 10 11 12 |
# File 'lib/random_point_generator.rb', line 7 def random_point y_range = (sw_lat .. ne_lat) x_range = (sw_lng .. ne_lng) [rand(y_range), rand(x_range)] end |