// PascalABC.NET 3.0, сборка 1088
const
n=5;
var
s:set of 1..10;
k,t:1..10;
begin
Randomize;
k:=0;
repeat
t:=Random(10)+1;
if not (t in s) then begin Include(s,t); Inc(k) end
until k=5;
for k:=1 to 10 do
if k in s then Write(k,' ');
Writeln
end.
Тестовое решение:
2 7 8 9 10