Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to generate random latitude and longitude which is located in city (one city) for my application written in Java, how can I generate it?
Posted
Comments
[no name] 12-Aug-14 10:12am    
You generate a random number for the latitude and a random number for the longitude....
Coder93 12-Aug-14 11:12am    
I know that I can generate random double number with following code, my problem is how to fix it to generate double number in an city boundry!

double start;
double end;
double random = new Random().nextDouble();
double result = start + (random * (end - start));

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900