I've got a question. I need to generate 1000 random numbers from 0 to 1000000. Then I need to put it into 16 rows and save it into a new file. That's the beginning of this code. I'm a beginner. Could you please advise? How can I write this to use it then to multithreaded merge sort?
import java.util.Random;
import java.util.ArrayList;
import java.util.Collections;
public class list1 {
public static void main(String[] args) {
ArrayList <Integer> list = new ArrayList();
for (int i = 1; i < 1000000; i++) {
list.add(i);
}
Collections.shuffle(list);
for (int i = 0; i < 1000; i++) {
System.out.println(list.get(i));
}
}
}
Aucun commentaire:
Enregistrer un commentaire