Java tutorial
//package com.java2s; import java.util.Random; public class Main { public static int radrom(int max, int position) { Random random = new Random(); int randomNum = random.nextInt(max); if (position == randomNum) { randomNum = radrom(max, position); } return randomNum; } }