0

Hello, guys!

I have to generate 10 different numbers.

What I do is to store the generated numbers in array.

Before that I check the array for duplicates.

It compiles, but I get some duplicates.

Thanks in advance for any help.

```
program rand;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
j, i, a, m: integer;
number: array[1..10] of integer;
included: boolean;
begin
j := 1;
m := 1;
while j < 11 do
begin
randomize;
a := random(11);
// Checking array for duplicates.
for i := 1 to 10 do
begin
if (number[i] = a) or (a=0) then
begin
included := true;
end
else
begin
included := false;
end; {if loop}
end; {for loop}
// Adding number to array.
if not included then
begin
number[m] := a;
m := m + 1;
j := j + 1;
end; {if loop}
end; {while loop}
// Printing out all numbers in array.
for i := 1 to 10 do
begin
writeln(number[i]);
end;
readln;
end.
```