Skip to Content
๐ŸŽฒ Welcome to RandBox - Powerful JavaScript Random Data Generation Library! Learn More

longitude

// usage randBox.longitude() randBox.longitude({fixed: 7}) randBox.longitude({format: 'dms'})

Generate a random longitude.

randBox.longitude(); => 149.41549

range: -180 to 180

By default includes 5 fixed digits after decimal, can specify otherwise.

randBox.longitude({fixed: 7}); => 51.4549925

By default includes entire range of allowed longitudes, can specify a min and/or max to bound it

randBox.longitude({min: -78, max: -77}); => -77.22644

By default longitudeโ€™ format is dd, can specify otherwise.

randBox.longitude({format: 'ddm'}); => "41ยฐ44.9592"
randBox.longitude({format: 'dms'}); => "56ยฐ2โ€™9.8187โ€"
Last updated on: