in reply to
Check randomly generated numbers have not been used before
Two approaches that might be of interest. In case you require a randomized list of unique numbers, then the problem isn't really about rand() generation, it's a list shuffling task.
use List::Util q(shuffle);
print join q(,), shuffle 1 .. 1000;
With a large number of elements, various optimizations may become appropriate, such as packed vectors, mmap'ed files, etc.
The second approach is to use a suitable pseudo-random number generator. One might choose a very simple linear congruential generator with a period of m. E.g. with m==224, a range and period of 16777216 is obtainable. Discard values >= 1e7 and you have a sequence of non-repeating pseudo-random numbers to cover the required 7-digit range. Keep in mind that this list will be a very weak and pseudo random sequence, suitable only in cases where the demands are casual.