I am writing a program which involves generating 20 random numbers in the range of 1..100 and display them on the screen. However, each number must be unique so there should be no duplicates. So if a number has been genertaed, it cannot be generated again.
Below is my source code which I managed to write. However I have 2 problems with it. When i set the randmax to 100, a 216 run time error is given. When i set it to a low number such as 10, the program works but nothing is displayed.
Could anyone help please?
[color=Red][b]Edit: I finally managed to solve the problem; I had to do it in a different way but it worked. Thanks for your help it helped me a lot.[/b][/color]
i, j, rand : Integer;
nums : Array[1..arraymax] of Integer;
check : Boolean;
While (j<arraymax) or (check=False) do
For i:=1 to arraymax do