Advertisement
namereq

シャッフル

Jun 6th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.32 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.Collections;
  3.  
  4. public class Shuffle{
  5.     public static void main(String[] args){
  6.         int N = 100;
  7.         ArrayList<Integer> list = new ArrayList<Integer>();
  8.  
  9.         for(int i = 1 ; i <= N ; i++) {
  10.             list.add(i);
  11.         }
  12.  
  13.         Collections.shuffle(list);
  14.        
  15.         System.out.println(list);
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement