If you want a series of random numbers that will not contain identicals try
(1) creating a int array to hold your random numbers
(2) As many times as you need numbers:
(a) generate random numbers in the desired range
(b)
test each number against all already stored in the array - this would likely be a method like "isANewOne" that returns a boolean. If isANewOne returns true you add the new random to the array and count that as one more successful find, otherwise you generate & test a new random.
(3)Once your number of successful finds equals the number of unique randoms needed, you're done.
(4)Remember to testy that the request is possible - for example, there's only 40 unique randoms between 1 and 40.