function getMyNumber:integer;
const N=4;
var
num:Array[0..1] of array [0..N] of Integer;
i,j,t:integer;
begin
num[0,0]:=2;
num[0,1]:=3;
num[0,2]:=4;
num[0,N-1]:=Random(10);
num[0,N ]:=Random(10);
for i:=0 to N do num[1,i]:=Random(1000);
for i:=0 to N-1 do for j:=i+1 to N do
if num[1,j]>num[1,i] then
begin
t:=num[1,j];
num[1,j]:=num[1,i];
num[1,i]:=t;
t:=num[0,j];
num[0,j]:=num[0,i];
num[0,i]:=t;
end;
if num[0,0]=0 then num[0,0]:=Random(9)+1;
//处理第一位是否允许为0的情况,可以为0不要此句
t:=0;
for i:=0 to N do t:=10*t+num[0,i];
Result:=t;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(inttostr(getMyNumber));
end;