Random Geographical Coordinates
Generate random geographical coordinates for maps, GIS testing, or game worlds. Choose quantity and get fresh latitude and longitude points fast.
Random Geographical Coordinates
How this random coordinates generator works
Press Generate and you get a latitude and a longitude. Turn up the Number box for up to a hundred at once. Copy takes them.
Every other geography tool on this site draws from a list somebody wrote by hand. This one does not. It has no list. It computes a fresh pair of numbers each time, which makes it the only genuinely infinite generator here.
It also makes it the only one that can be wrong about mathematics. And the obvious way to write it is wrong.
The obvious way to pick a random point is wrong
Here is what almost every random coordinate generator on the internet does.
Pick a latitude uniformly between -90 and +90. Pick a longitude uniformly between -180 and +180. Print both.
The longitude line is correct. Every meridian really does have the same amount of surface hanging off it, so nothing is distorted going east and west.
The latitude line produces points that cluster at the poles. Not slightly. Enormously.
This is a well-known result rather than an obscure one. Wolfram MathWorld states it plainly: choosing spherical coordinates from uniform distributions is incorrect, and points chosen that way bunch near the poles.
The numbers
Take a band of the Earth's surface, ask what share of the planet it is, then ask what share of the naive method's points land in it.
- Within 30 degrees of the equator. That band is exactly half the surface of the Earth. The naive method puts 33.3% of its points there. A correct method puts 50.0%.
- Poleward of 60 degrees, north and south together. That is 13.4% of the Earth. The naive method puts 33.3% of its points there, two and a half times too many.
- Poleward of 80 degrees. In each hemisphere that is 0.76% of the Earth, a sliver. The naive method puts 5.6% of its points there. Seven times too many.
Ask the naive generator for a random place on Earth and one time in three it hands you the Arctic or the Antarctic. Ask for a hundred points and roughly six land inside a cap covering less than one percent of the world.
Why a rectangle is not a globe
Picture the lines of latitude on a globe. The equator is a full circle, about forty thousand kilometres around. The parallel at 60 degrees north is half that. The one at 80 degrees is about seven thousand kilometres. At 89 degrees it is a ring you could walk around in an afternoon.
Now picture a strip of the surface one degree tall. At the equator that strip is a long belt with a lot of ground in it. Near the pole it is a narrow ring with almost nothing in it. The area of a one degree by one degree cell shrinks with the cosine of the latitude, until at the pole it reaches zero.
Uniform latitude gives every one-degree strip the same probability. But the strips do not have the same area. So the small ones, near the poles, receive far more points per square kilometre than they deserve.
The mental error is imagining the Earth as a flat rectangle 180 tall and 360 wide, and throwing darts at it. That rectangle is a map projection. Projections distort area, and this one, at the poles, distorts it infinitely.
The correction is one line
The trick is that a uniform point on a sphere is uniform in the sine of its latitude, not in the latitude itself. So pick the sine uniformly between -1 and 1, and take the arcsine.
That is the whole correction. One call to Math.asin. The longitude line does not change.
That is the code running above this page. Simulate four hundred thousand points from it and you get 49.9% inside thirty degrees of the equator, and 13.4% poleward of sixty. Both correct to the second decimal place.
It is a satisfying kind of bug, because the wrong version looks more obviously right than the correct one. Nothing in latitude between -90 and 90 announces that it is distorting the planet.
How precise is a decimal place?
One degree of latitude is about 111 kilometres. Divide it down.
- One decimal place is about 11 kilometres.
- Three places, about 111 metres.
- Five places, about one metre.
- Six places, about eleven centimetres.
Six decimal places is a claim to have chosen a random point on Earth to the nearest hand's breadth. The digits would be real digits, and perfectly random, but the precision would be theatre.
This tool prints five, which is about a metre, and a metre is a claim worth making. If you are generating test data, pick the precision your system actually needs, and remember that longitude degrees narrow as you move away from the equator, so a degree of longitude in Reykjavik buys you far less ground than one in Nairobi.
Most of your points are at sea
About 71 percent of the Earth's surface is ocean. A genuinely uniform random point therefore has roughly a 29 percent chance of landing on ground.
Ask for ten points and expect seven of them to be water. This is not a fault. It is the single most important fact about the planet, and a random coordinate generator states it more forcefully than any textbook.
If you want a random point on land, no closed-form trick exists. You have to generate points and test them against a coastline, discarding the ones that fall in water. Expect to throw away seven in ten.
And note what the pole bias does to this. The extra points are not scattered over Kansas. They are dropped into the Arctic Ocean and onto the East Antarctic ice sheet, which are among the emptiest surfaces on Earth. Sampling a sphere correctly does not only fix the mathematics. It moves your points to where the world is.
Ways people actually use this
- Test data. Signed decimal degrees, five places, uniformly distributed over the actual sphere.
- Teaching probability. Ask a class to write this generator, then plot their points on a globe. The poles will be black.
- Games. Generate a point, find it on a satellite map, and write what happens there. Seven times in ten, nothing does.
- Sampling. If you need points on land, generate and reject. There is no shortcut.
- Not for navigation. These are random numbers, not places.
Questions people ask
How do you pick a truly random point on Earth?
Pick the longitude uniformly between -180 and 180. For the latitude, pick a number uniformly between -1 and 1 and take its arcsine, converting to degrees. Choosing the latitude uniformly instead produces points that cluster at the poles.
Why do points cluster at the poles?
Because a one degree band of latitude near the pole covers far less surface area than one at the equator, but uniform sampling gives every band the same probability. Area scales with the cosine of the latitude.
What is the chance a random point is on land?
About 29 percent, because roughly 71 percent of the Earth's surface is ocean. There is no simple formula for restricting points to land, so generators do it by rejecting the ones that fall in water.
How precise is a decimal degree?
One degree of latitude is roughly 111 kilometres, so one decimal place is about 11 km, three places about 111 m, five places about 1 m, and six places about 11 cm. Longitude degrees narrow as you move away from the equator.
Do negative numbers mean south and west?
Yes. Negative latitude is south of the equator and negative longitude is west of the Greenwich meridian. This tool outputs signed decimal degrees rather than degrees, minutes and seconds.
References
Skanda Aryal is a full stack engineer focused on accessible web experiences, with personal interests in time zones, travel, hiking, and geography. His enjoys playing with utilities tied to movement, schedules, places, and time based coordination. At Eon Tools, he reviews geography, transportation, times now, and date and time tools.
Other Tools
- Random African Countries
- Random Asian Countries
- Random Beach Name Generator
- Random Biome Generator
- Random Bridge Name Generator
- Random Castle Name Generator
- Random Cave Name Generator
- Random Continent Generator
- Random Country Calling Code
- Random Country Capital Generator
- Random Country Generator
- Random Country TLD Generator
- Random Currency Generator
- Random Desert Name Generator
- Random European Country Generator
- Random Famous Landmark Generator
- Random Fjord Name Generator
- Random Forest Name Generator
- Random Glacier Name Generator
- Random IATA Airport Code
- Random Island Name Generator
- Random Lake Name Generator
- Random Language Generator
- Random Mountain Generator
- Random National Park Generator
- Random Nationality Generator
- Random Oasis Name Generator
- Random Ocean Name Generator
- Random River Name Generator
- Random Road Trip Generator
- Random Sea Name Generator
- Random Stadium or Arena Generator
- Random Time Zone Generator
- Random Topography Generator
- Random Volcano Name Generator
- Random Waterfall Name Generator