H
hying95
Unregistered / Unconfirmed
GUEST, unregistred user!
//随机产生1..49的函数
Function MLKJ: TStrings;
var
i,n: integer;
Data: array [1..10000] of integer;
Datacount: integer;
begin
Result:=TStringList.Create;
for i := 10000 downto 1 do
Data := i;
Datacount := 49;
RandSeed:=Datacount;
Randomize;
while Result.Count<7 do
begin
n:= random(Datacount)+1;
s:=inttostr(Data[n]);
Result.Add(Add_Space(s,'0',2));
Data[n] := Data[Datacount-1];
Datacount := Datacount-1;
end;
end;
procedure TFrmYC.bsSkinSpeedButton1Click(Sender: TObject);
var
i,j,L: integer;
TT,TT1: String;
CS: DWord;
s,aErr: string;
begin
aTime:=0;
memo3.Clear;
JGDC.Text :='';
EdtJG.Text :='';
PSS.Caption :='';
CS:=0;
TT:='';
TT1:='';
stop:=false;
table1.MoveBy(strtoint(cbQS.Text));
for i := 1 to strtoint(cbQS.Text) dO
begin
table1.MoveBy(-1);
s:=table1.FieldValues['TM];
s:=GetDSBSDX(s,cbLX.Text);
TT:=S+TT;
end;
L:=Length(TT);
timer1.Enabled :=true;
for j := 1 to 1000000 do
begin
Application.ProcessMessages;
if Stop then
begin
Stop:=false;
break;
end;
st.Clear;
st.AddStrings(MLKJ);
s:='';
for i:= 0 to 6 do
begin
s:=s+st.Strings+' ';
end;
if Pm_S.Checked=true then
begin
if memo3.Lines.Count>strtoint(cbQS.Text) then
memo3.Lines.Delete(0);
memo3.Lines.Add(s+GetDSBSDX(ST.Strings[6],cbLX.Text));
end;
LBLB.Caption:='计算次数';
LBXQ.Caption:='用时';
EdtJG.Text :=inttostr(j);
JGDC.Text:=inttostr(aTime);
TT1:=GetDSBSDX(ST.Strings[6],cbLX.Text)+TT1;
if Length(TT1)>L then
TT1:=Copy(TT1,1,L);
IF J>strtoint(cbQS.Text) then
begin
if TT1=TT then
begin
st.Clear;
st.AddStrings(MLKJ);
for i:= 0 to 6 do
begin
(FindComponent('E'+inttostr(i+1)) as TEdit).Text:=st.Strings;
end;
break;
end;
end;
CS:=J;
if (CS=1000000) and (copy(TT1,1,L)<>TT) then
begin
ULH.FrmLH.Message1.Messagedlg('已计算了:'+inttostr(cs)+
' 次是否在计算一次!?',mtInformation,[mbOK],1);
exit;
end;
end;
LBLB.Caption :=cbLX.Text+'OK;
if table1.RecNo<>1 then
begin
table1.MoveBy(-1);
JGDC.Text:=GetDSBSDX(Table1.FieldValues['TM],cbLX.Text);
table1.MoveBy(1);
end else JGDC.Text:='';
EdtJG.Text:=GetDSBSDX(ST.Strings[6],cbLX.Text);
if JGDC.Text<>'' then
if (EdtJG.Text=JGDC.Text) then aErr:=',结果正确!!!' else aErr:=
',结果错误!!!' else aErr:='';
timer1.Enabled :=false;
beep;
PSS.Caption :='计算次数:'+inttostr(CS)+'次'+aErr+',用时: '+inttostr(aTime)+' 秒';
//DoBleep(2000,200);//声音提示
LBLB.Caption:=cbLX.text+'中特';
LBXQ.Caption:='结果';
end;
table中主要有这样一些字段:
YY,QS,P1,P2,P3,P4,P5,P6,TM
上面的一段代码,cbQS.Text假如为10那么就从数据库中找出以当前记录为准往下10条记录连接成字串TT.
然后随机函数,循环产生七组数,取最后一个数,把它连接成字符串TT1,如果连续10次吻合,那么就再产生一个七组数,
在MEMO不工作,一个循环计算1000000化时,528秒,(512内存,P4 1.7G CPU);
有点慢.
Function MLKJ: TStrings;
var
i,n: integer;
Data: array [1..10000] of integer;
Datacount: integer;
begin
Result:=TStringList.Create;
for i := 10000 downto 1 do
Data := i;
Datacount := 49;
RandSeed:=Datacount;
Randomize;
while Result.Count<7 do
begin
n:= random(Datacount)+1;
s:=inttostr(Data[n]);
Result.Add(Add_Space(s,'0',2));
Data[n] := Data[Datacount-1];
Datacount := Datacount-1;
end;
end;
procedure TFrmYC.bsSkinSpeedButton1Click(Sender: TObject);
var
i,j,L: integer;
TT,TT1: String;
CS: DWord;
s,aErr: string;
begin
aTime:=0;
memo3.Clear;
JGDC.Text :='';
EdtJG.Text :='';
PSS.Caption :='';
CS:=0;
TT:='';
TT1:='';
stop:=false;
table1.MoveBy(strtoint(cbQS.Text));
for i := 1 to strtoint(cbQS.Text) dO
begin
table1.MoveBy(-1);
s:=table1.FieldValues['TM];
s:=GetDSBSDX(s,cbLX.Text);
TT:=S+TT;
end;
L:=Length(TT);
timer1.Enabled :=true;
for j := 1 to 1000000 do
begin
Application.ProcessMessages;
if Stop then
begin
Stop:=false;
break;
end;
st.Clear;
st.AddStrings(MLKJ);
s:='';
for i:= 0 to 6 do
begin
s:=s+st.Strings+' ';
end;
if Pm_S.Checked=true then
begin
if memo3.Lines.Count>strtoint(cbQS.Text) then
memo3.Lines.Delete(0);
memo3.Lines.Add(s+GetDSBSDX(ST.Strings[6],cbLX.Text));
end;
LBLB.Caption:='计算次数';
LBXQ.Caption:='用时';
EdtJG.Text :=inttostr(j);
JGDC.Text:=inttostr(aTime);
TT1:=GetDSBSDX(ST.Strings[6],cbLX.Text)+TT1;
if Length(TT1)>L then
TT1:=Copy(TT1,1,L);
IF J>strtoint(cbQS.Text) then
begin
if TT1=TT then
begin
st.Clear;
st.AddStrings(MLKJ);
for i:= 0 to 6 do
begin
(FindComponent('E'+inttostr(i+1)) as TEdit).Text:=st.Strings;
end;
break;
end;
end;
CS:=J;
if (CS=1000000) and (copy(TT1,1,L)<>TT) then
begin
ULH.FrmLH.Message1.Messagedlg('已计算了:'+inttostr(cs)+
' 次是否在计算一次!?',mtInformation,[mbOK],1);
exit;
end;
end;
LBLB.Caption :=cbLX.Text+'OK;
if table1.RecNo<>1 then
begin
table1.MoveBy(-1);
JGDC.Text:=GetDSBSDX(Table1.FieldValues['TM],cbLX.Text);
table1.MoveBy(1);
end else JGDC.Text:='';
EdtJG.Text:=GetDSBSDX(ST.Strings[6],cbLX.Text);
if JGDC.Text<>'' then
if (EdtJG.Text=JGDC.Text) then aErr:=',结果正确!!!' else aErr:=
',结果错误!!!' else aErr:='';
timer1.Enabled :=false;
beep;
PSS.Caption :='计算次数:'+inttostr(CS)+'次'+aErr+',用时: '+inttostr(aTime)+' 秒';
//DoBleep(2000,200);//声音提示
LBLB.Caption:=cbLX.text+'中特';
LBXQ.Caption:='结果';
end;
table中主要有这样一些字段:
YY,QS,P1,P2,P3,P4,P5,P6,TM
上面的一段代码,cbQS.Text假如为10那么就从数据库中找出以当前记录为准往下10条记录连接成字串TT.
然后随机函数,循环产生七组数,取最后一个数,把它连接成字符串TT1,如果连续10次吻合,那么就再产生一个七组数,
在MEMO不工作,一个循环计算1000000化时,528秒,(512内存,P4 1.7G CPU);
有点慢.