We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d8f3eab commit d9bce12Copy full SHA for d9bce12
package.json
@@ -1,6 +1,6 @@
1
{
2
"name": "random-location",
3
- "version": "1.0.5",
+ "version": "1.0.6",
4
"description": "Random coordinates within a circle given a center point and radius",
5
"main": "src/index.js",
6
"scripts": {
src/index.js
@@ -57,7 +57,11 @@ Where -90 <= A <= 90 and -180 <= B <= 180.
57
radius R is in meters.
58
*/
59
const randomCirclePoint = (centerPoint, radius) => {
60
- return randomCircumferencePoint(centerPoint, Math.random() * radius)
+ // http://mathworld.wolfram.com/DiskPointPicking.html
61
+ return randomCircumferencePoint(
62
+ centerPoint,
63
+ Math.sqrt(Math.random()) * radius
64
+ )
65
}
66
67
/*
0 commit comments