My task is to print 1,000,000 random numbers between 0 and 1 with the use of loops.
I've chosen to use the function Math.random to do this and a for loop to create 1,000,000.
Now I need to print the max value of the numbers...but how? Is it possible to do it within putting them into an array?
Here's my code so far:
public class GenerateRandomNumbers
{
public static void main(String[]args)
{
for(int i=0; i < 1000000; i++){
System.out.println(Math.random());
}
}
}
Aucun commentaire:
Enregistrer un commentaire