Topic: how can i create random numbers without repetition
hello all
how can i create random numbers without repetition
thanks for help
My Visual Database → Script → how can i create random numbers without repetition
hello all
how can i create random numbers without repetition
thanks for help
hello all
how can i create random numbers without repetition
thanks for help
procedure Form1_Button2_OnClick (Sender: TObject; var Cancel: boolean);
var
i,s,int: integer;
begin
s:=1;
while s<>0 do
begin
for i := 1 to 5 do
begin
int := 1 + Random(100);
end;
s:=SQLExecute('SELECT IFNULL(id,0) FROM randomInteger WHERE intege='+IntToStr(int));
end;
if (s=0) then begin
SQLExecute('INSERT INTO randomInteger (intege)VALUES("'+IntToStr(int)+'")');
UpdateDataBase('randomInteger');
Form1.TableGrid2.dbUpdate;
end;
end;
hello sibprogsistem
thank you very much
i tired to apply this code to my file
can you please solve my file
thanks for help
hello sibprogsistem
thank you very much
i tired to apply this code to my file
can you please solve my file
thanks for help
procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
var
i,s,r: Integer;
str:Boolean;
begin
for i:=0 to Form1.ComponentCount-1 do begin
if (Form1.Components[i] is TdbEdit) then begin
repeat
str:=False;
r:=random(100);
for s:=0 to Form1.ComponentCount-1 do begin
if (Form1.Components[s] is TdbEdit) then
if (TdbEdit(Form1.Components[s]).Value=r) then str:=True;
end;
if (str=False) then TdbEdit(Form1.Components[i]).Value:=r;
until str=False;
end;
end;
end;
hello derek
thank you very much
but how can i use for loop because i have more text boxes
thanks for help
hello sibprogsistem
thank you very much
when i press the button first time i found empty textboxes
can you check it again
thanks for help
hello sibprogsistem
thank you very much
when i press the button first time i found empty textboxes
can you check it again
thanks for help
я поменял
until str=True;
на
until str=False;
и все поля заполняются
hello sibprogsistem
thank you very much
works fine
happy new year
hello sibprogsistem
How can I exclude TextBox1
this code not working
procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
var
i,s,r: Integer;
str:Boolean;
begin
for i:=2 to Form1.ComponentCount-1 do begin
if (Form1.Components[i] is TdbEdit) then begin
repeat
str:=False;
r:=random(100);
for s:=2 to Form1.ComponentCount-1 do begin
if (Form1.Components[s] is TdbEdit) then
if (TdbEdit(Form1.Components[s]).Value=r) then str:=True;
end;
if (str=False) then TdbEdit(Form1.Components[i]).Value:=r;
until str=False;
end;
end;
end;
thanks for help
hello sibprogsistem
How can I exclude TextBox1
в этом примере я исключил edit2
procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
var
i,s,r: Integer;
str:Boolean;
begin
for i:=0 to Form1.ComponentCount-1 do begin
if (Form1.Components[i] is TdbEdit) AND ((TdbEdit(Form1.Components[i]).Name<>'Edit2')) then begin
repeat
str:=False;
r:=random(100);
for s:=0 to Form1.ComponentCount-1 do begin
if (Form1.Components[s] is TdbEdit) then
if (TdbEdit(Form1.Components[s]).Value=r) then str:=True;
end;
if (str=False) then TdbEdit(Form1.Components[i]).Value:=r;
until str=False;
end;
end;
end;
thank you sibprogsistem
You are the king of codes
happy time and happy new year
My Visual Database → Script → how can i create random numbers without repetition
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi