To call the random number between 1 and 20 just use the solution #1
But... to make it repetition safe...
0) Create an empty result_array for your 10 result numbers
1) Fill one check_array[20] with numbers from 1 to 20 to track what has been used
2) within a loop until you get the 10 random numbers without repetition
2.1) call the random function of solution #1
2.2) check if the number has been already used (is this number still in the array of (1)?)
2.2.1) If yes... save the random number to the next empty position of your results array and put a "0" in that check_array's position
2.2.2) if not... start 2 again
2.3) if you already have all 10 non-repeated numbers... end loop
3) Print out your results