...while all the code wizards out here are answering this question or requesting the code for this answer it is important to remember the truth about "random()"
...generating random numbers DOES NOT GUARANTEE that you will only see any given number once and only once... the reason is because of the function itself.
When you ask for random numbers, you are asking for a number to be picked without pattern, or by chance, or without consideration to the previous or next number to be picked. But if you really want a number to be generated once and only once, then random is not the function for you.
For a number to be used once and only once (even among a trillion other numbers) then that number must be considered UNIQUE. By using random, you are asking for any number (whether in a range or not) and you don't care which one... but most people when using random number generation are doing so under the expectation that the numbers generated will never be seen again.
That isn't how random numbers work, that is how unique numbers work.