JavaScript - How to create random longitude and latitudes?
<p>I am trying to create random longitude and latitudes.  I need to create numbers between 
-180.000 and +180.000.  So, I might get 101.325 or -3.546 or -179.561.</p>

<p>Can you tell me a quick formula for that?  </p>

<p>Thanks to everyone for your help. I have combined a couple of examples to suit my needs.  Yes, I could shorten the code, but this really helps to see what's going on.</p>

<pre><code>// LONGITUDE -180 to + 180
function generateRandomLong() {
    var num = (Math.random()*180).toFixed(3);
    var posorneg = Math.floor(Math.random());
    if (posorneg == 0) {
        num = num * -1;
    }
    return num;
}
// LATITUDE -90 to +90
function generateRandomLat() {
    var num = (Math.random()*90).toFixed(3);
    var posorneg = Math.floor(Math.random());
    if (posorneg == 0) {
        num = num * -1;
    }
    return num;
}
</code></pre>
