fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. static Random random = new Random();
  11.  
  12. public static double aleatorioEntre(double min, double max){
  13. return random.nextDouble() * (max-min) + min;
  14. }
  15.  
  16. public static void main (String[] args) throws java.lang.Exception
  17. {
  18. double randomLatitude = aleatorioEntre(-9.5, -6.2);
  19. double randomLongitude = aleatorioEntre(36.8, 42.2);
  20.  
  21. System.out.println(randomLatitude);
  22. System.out.println(randomLongitude);
  23. }
  24. }
Success #stdin #stdout 0.05s 4575232KB
stdin
Standard input is empty
stdout
-7.5734280187606124
40.828440276419215