-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Conversation
Sometimes you may want to set lat/lng parameters for a spesific area. Ex: For Istanbul: 'lat' => $faker->latitude(40.958836, 41.136456), 'lng' => $faker->longitude(28.64, 29.98),
* @example 77.147489 | ||
* @return float Uses signed degrees format (returns a float number between -90 and 90) | ||
* @example '77.147489' | ||
* @param int $min |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a float
, not an int
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for missing that, Phpstorm decided it, not me :)
Please also update the README to add an example with the new parameter |
{ | ||
return static::randomFloat(6, 0, 180) - 90; | ||
return floatval(number_format(mt_rand($min * 1000000, $max * 1000000)/1000000, 6)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the interest of converting a float to string (with number_format
) and then back to float (with floatval
)
Tests fail |
Also, please see #416 for why you should use |
@fzaninotto @actuallymab Any update on this PR?. we are really interested in this feature |
don't know.. @fzaninotto ok with this? |
* @return float Uses signed degrees format (returns a float number between -90 and 90) | ||
*/ | ||
public static function latitude() | ||
public static function latitude($min = -90, $max = 90) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're changing the results of existing calls. Please use 0 and 180 as min and max values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
He isn't. Look again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, you're right.
min / max for lat long values
Thanks |
Sometimes you may want to set lat/lng parameters for a spesific area.
Ex:
For Istanbul:
'lat' => $faker->latitude(40.958836, 41.136456),
'lng' => $faker->longitude(28.64, 29.98),