use strict;
use warnings;
my @random_set;
my %seen;
for (1..10) {
my $candidate = int rand(1185);
redo if $seen{$candidate}++;
push @random_set, $candidate;
}
print join(', ', @random_set), "\n";
If you need to generate many more than 10 distinct random numbers, this solution will be faster because the hash lookup works in constant time, whereas your solution has to iterate over the whole array for each number. For 10 there won't be a big difference.
Also note that for testing it is better to reduce the maximum number so that collision become more likely  I tested it with 12 instead of 1185.
Update: If the maximal number is the same or not much larger than the number of random values you want, this would probably be faster:
use List::Util qw/shuffle/;
my @random_set = (shuffle 0..11)[0..9];
That is, first generating a random permutation, and then selecting some of the elements.
But as always it's best to Benchmark the different solutions with realworld data.
