package jp.co.jid.exBasic;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

public class MyList {
	private static final int RANDOM_NUMBER = 101;

	public List<Integer> getRondomNumberList(int count) {
		ArrayList<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < count; i++) {
			list.add(Integer.valueOf((int)(Math.random() * 101)));
		}
		return list;
	}

	public List<Integer> getRondomNumberDuplicationList(int count) {
		if (count > RANDOM_NUMBER) {
			return null;
		}
		ArrayList<Integer> list = new ArrayList<Integer>();
		while (list.size() < count) {
			Integer integer = Integer.valueOf((int)(Math.random() * RANDOM_NUMBER));
			if (!list.contains(integer)) {
				list.add(integer);
			}
		}
		return list;
	}

	public List<Integer> getRondomNumberDuplicationList2(int count) {
		if (count > RANDOM_NUMBER) {
			return null;
		}
		ArrayList<Integer> list = new ArrayList<Integer>();
		HashSet<Integer> set = new HashSet<Integer>();
		while (set.size() < count) {
			set.add(Integer.valueOf((int)(Math.random() * RANDOM_NUMBER)));
		}
		return list;
	}
}
