import java.util.ArrayList; import java.util.Collections; public class Acak { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here int bilAwal = 0; int bilAkhir = 10; int jumlahBil = 10; ArrayList<Integer> list = new ArrayList<Integer>(); for (int i=bilAwal; i<bilAkhir; i++) { list.add(new Integer(i)); } Collections.shuffle(list); for (int i=0; i<jumlahBil; i++) { System.out.println(list.get(i)); } } }output : 9 6 0 5 4 8 3 1 7
Next
« Prev Post
« Prev Post
Previous
Next Post »
Next Post »
Subscribe to:
Post Comments (Atom)
0 Komentar
Penulisan markup di komentar