+ 1
The Random variable.
Does the float "random" exist in Java? If it does, how do I have to use it?
3 ответов
+ 2
This may help:
Random randFloat = new Random(10);
float num = randFloat.nextFloat();
Random randInt = new Random(10);
int num1 = randInt.nextInt();
System.out.println(num);
System.out.println(num1);
When first run results were:
0.73043025
-1157793070
+ 2
https://code.sololearn.com/ckcAXAaHfQI9/?ref=app
Program which will generate some random numbers and sort them in descending order
0
import java.util.Random
Random rand = new Random();