S
sgwk
Unregistered / Unconfirmed
GUEST, unregistred user!
Function GetRandomString: String;
const
Max_Len = 10;
var
i: Byte;
s: string
begin
Randomize;
s :='0123456789';
Result := '';
for i := 0 to Max_Len-1 do
Result := Result + inttostr(Random(Length(s)));
end;
procedure TForm1.Button1Click(Sender: TObject);
var
s1: TStringList;
s:string;
a:integer;
b:integer;
begin
edit1.Text:=timetostr(time);
b:=strtoint(edit3.text);
s1:= TStringList.Create;
for a:=1 to b do
begin
s:=GetRandomString;
s1.Add(s);
end;
s1.SaveToFile('d:/ok.txt');
edit2.Text:=timetostr(time);
beep;
showmessage('完成');
end;
end.
一次产生100万条10位的数字,偶尔会出现重复。想不通,random的 关系么? 请大家讨论一下。
const
Max_Len = 10;
var
i: Byte;
s: string
begin
Randomize;
s :='0123456789';
Result := '';
for i := 0 to Max_Len-1 do
Result := Result + inttostr(Random(Length(s)));
end;
procedure TForm1.Button1Click(Sender: TObject);
var
s1: TStringList;
s:string;
a:integer;
b:integer;
begin
edit1.Text:=timetostr(time);
b:=strtoint(edit3.text);
s1:= TStringList.Create;
for a:=1 to b do
begin
s:=GetRandomString;
s1.Add(s);
end;
s1.SaveToFile('d:/ok.txt');
edit2.Text:=timetostr(time);
beep;
showmessage('完成');
end;
end.
一次产生100万条10位的数字,偶尔会出现重复。想不通,random的 关系么? 请大家讨论一下。