vendredi 4 novembre 2016

What is the best way to generate a random float value included into a specified value interval?

I have the following doubt related how to generate a random float value in Java.

The value have to be into a specific range of possible values.

For example I have to generate a random value that is in the following range:

MIN: 41,815080 MAX: 41,829191

(these values represent possible longitute of a point on a map, I need to generate a random point that have a longitude that is included in this range).

What is a smart way to do it?




Aucun commentaire:

Enregistrer un commentaire