I’m trying to generate some dummy records in MySQL and need to create random latitude and longitude float values within a given range.
For example I need to generate latitudes that are between 52.077090052913654 and 52.477040512464626
and longitudes between -1.8840792500000134 and -0.9172823750000134
I’m familiar with creating ranges of random numbers using Rand Floor but that will only produce whole numbers. How I might do this?
You can use
RAND()to get a random value between two values like so:randVal = (RAND() * (maxVal - minVal)) + minValWith your numbers: