What's the difference in using random
without import
, right in method.
public class random {
public static void main(String[] args) {
int x = (int) (Math.random() * 10);
System.out.println(x);
}
}
Or with the import in the class, what's the difference?
import java.util.Random;
public class random {
public static void main(String[] args) {
Random aleatorio = new Random();
int numero = aleatorio.nextInt(10);
System.out.println(numero);
}
}