It can be done by using the function that already been provided by the library such as Random().
The thing comes out when we want unique random numbers. How should I do?
Step 1, generate random number and insert it into first element of an array.
Step 2, generate random number and check whether the random number is already exist in the array or not.
If the result is already exist, then repeat step 2.
If the result is not exist, then insert the random number to the next element of the array.
Here is the implementation in Java Programming Language:
Here is the implementation in C# Programming Language: