New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

random-location

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

random-location - npm Package Compare versions

Comparing version

to
1.0.6

3

dist/index.js

@@ -62,3 +62,4 @@ "use strict";

var randomCirclePoint = function randomCirclePoint(centerPoint, radius) {
return randomCircumferencePoint(centerPoint, Math.random() * radius);
// http://mathworld.wolfram.com/DiskPointPicking.html
return randomCircumferencePoint(centerPoint, Math.sqrt(Math.random()) * radius);
};

@@ -65,0 +66,0 @@

@@ -142,3 +142,4 @@ (function webpackUniversalModuleDefinition(root, factory) {

var randomCirclePoint = function randomCirclePoint(centerPoint, radius) {
return randomCircumferencePoint(centerPoint, Math.random() * radius);
// http://mathworld.wolfram.com/DiskPointPicking.html
return randomCircumferencePoint(centerPoint, Math.sqrt(Math.random()) * radius);
};

@@ -145,0 +146,0 @@

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.randomLocation=e():t.randomLocation=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,n){"use strict";var o=Math.PI/180,i=3*Math.PI,a=2*Math.PI,u=function(t){return t*o},r=function(t){return t/o},d=function(t,e){var n=Math.sin(u(t.latitude)),o=Math.cos(u(t.latitude)),d=Math.random()*a,l=Math.sin(d),c=Math.cos(d),s=e/6371e3,f=Math.sin(s),h=Math.cos(s),M=void 0,p=void 0;return M=Math.asin(n*h+o*f*c),p=u(t.longitude)+Math.atan2(l*f*o,h-n*Math.sin(M)),p=(p+i)%a-Math.PI,{latitude:r(M),longitude:r(p)}},l=function(t,e){return d(t,Math.random()*e)},c=function(t,e){var n={latitude:u(t.latitude),longitude:u(t.longitude)},o={latitude:u(e.latitude),longitude:u(e.longitude)},i={latitude:Math.sin((o.latitude-n.latitude)/2),longitude:Math.sin((o.longitude-n.longitude)/2)},a=i.latitude*i.latitude+i.longitude*i.longitude*Math.cos(n.latitude)*Math.cos(o.latitude);return 2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))*6371e3};t.exports={distance:c,randomCircumferencePoint:d,randomCirclePoint:l}}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.randomLocation=e():t.randomLocation=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,n){"use strict";var o=Math.PI/180,i=3*Math.PI,a=2*Math.PI,r=function(t){return t*o},u=function(t){return t/o},d=function(t,e){var n=Math.sin(r(t.latitude)),o=Math.cos(r(t.latitude)),d=Math.random()*a,l=Math.sin(d),c=Math.cos(d),s=e/6371e3,f=Math.sin(s),h=Math.cos(s),M=void 0,p=void 0;return M=Math.asin(n*h+o*f*c),p=r(t.longitude)+Math.atan2(l*f*o,h-n*Math.sin(M)),p=(p+i)%a-Math.PI,{latitude:u(M),longitude:u(p)}},l=function(t,e){return d(t,Math.sqrt(Math.random())*e)},c=function(t,e){var n={latitude:r(t.latitude),longitude:r(t.longitude)},o={latitude:r(e.latitude),longitude:r(e.longitude)},i={latitude:Math.sin((o.latitude-n.latitude)/2),longitude:Math.sin((o.longitude-n.longitude)/2)},a=i.latitude*i.latitude+i.longitude*i.longitude*Math.cos(n.latitude)*Math.cos(o.latitude);return 2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))*6371e3};t.exports={distance:c,randomCircumferencePoint:d,randomCirclePoint:l}}])});
//# sourceMappingURL=randomLocation.umd.min.js.map
{
"name": "random-location",
"version": "1.0.5",
"version": "1.0.6",
"description": "Random coordinates within a circle given a center point and radius",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -60,3 +60,7 @@ const EARTH_RADIUS = 6371000 // meters

const randomCirclePoint = (centerPoint, radius) => {
return randomCircumferencePoint(centerPoint, Math.random() * radius)
// http://mathworld.wolfram.com/DiskPointPicking.html
return randomCircumferencePoint(
centerPoint,
Math.sqrt(Math.random()) * radius
)
}

@@ -63,0 +67,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet