Skip to content

Instantly share code, notes, and snippets.

@vincicat
Created December 4, 2019 05:21
Show Gist options
  • Save vincicat/0a989ab64c927aba161f0ad9ef8e4d37 to your computer and use it in GitHub Desktop.
Save vincicat/0a989ab64c927aba161f0ad9ef8e4d37 to your computer and use it in GitHub Desktop.
Generate Random Markers
function generateMarkers(fromCoordinate) {
const result = [];
const {latitude, longitude} = fromCoordinate;
for (let i = 0; i < 10; i++) {
let id = Math.ceil(Math.random() * 10000);
const newMarker = {
coordinate: {
latitude: latitude + (Math.random() - 0.5) * (LATITUDE_DELTA / 2),
longitude: longitude + (Math.random() - 0.5) * (LONGITUDE_DELTA / 2),
},
key: `foo-${id + i}`,
};
result.push(newMarker);
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment