When using predefined variables to return values, is it possible to limit $randomLongitude to UK coordinates only?
Hey @w4dd325
I’m totally stealing this from Stackoverflow, as there isn’t a way to configure the location for the dynamic variables:
function getRandomInRange(from, to, fixed) {
return (Math.random() * (to - from) + from).toFixed(fixed) * 1;
// .toFixed() returns string, so ' * 1' is a trick to convert to number
}
console.log(getRandomInRange(-180, 180, 3));
You could pass in the UK coords into that function and create a randomly generated location that way?
The United Kingdom is located on the geographic coordinates of 53.5500° N latitude and 2.4333° W longitude in Europe.
1 Like
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.