Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
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