Created
December 4, 2019 05:21
-
-
Save vincicat/0a989ab64c927aba161f0ad9ef8e4d37 to your computer and use it in GitHub Desktop.
Generate Random Markers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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