import java.util.HashSet;
import java.util.Random;

public class Randomizer extends Random {
	private static final long serialVersionUID = 1L;

	public Randomizer(long val) {
		super(val);
	}

	public int nextInt(int l, int r) {
		return super.nextInt(r - l + 1) + l;
	}

	public int[] nextDiffIntegers(int n, int l, int r) {
		HashSet<Integer> was = new HashSet<>();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt(l, r);
			while (was.contains(a[i])) {
				a[i] = nextInt(l, r);
			}
			was.add(a[i]);
		}
		return a;
	}

	public int[] getRandomPermutation(int n) {
		int[] a = new int[n];
		for (int i = 1; i < n; i++) {
			a[i] = i;
			int num = nextInt(i + 1);
			int t = a[i];
			a[i] = a[num];
			a[num] = t;
		}
		return a;
	}

}
