Sortear numero! Como ?
Como fazer para sortear numeros no delphi ? Como fazer ao clicar em um botão apareça em um LABEL um numero sorteado ?
Rodrigo!
Rodrigo!
Ropesca
Curtidas 0
Respostas
Carnette
13/03/2003
Como fazer para sortear numeros no delphi ? Como fazer ao clicar em um botão apareça em um LABEL um numero sorteado ?
Rodrigo!
no evento onCLick do botão
Label.Caption := Random(VariavelMáximaquevocequergeraronumerorandomico) ;
GOSTEI 0
Carnette
13/03/2003
[quote:18af48596f=´ropesca´]Como fazer para sortear numeros no delphi ? Como fazer ao clicar em um botão apareça em um LABEL um numero sorteado ?
Rodrigo!
no evento onCLick do botão
Label.Caption := Random(VariavelMáximaquevocequergeraronumerorandomico) ;[/quote:18af48596f]
Ops..: foi incompleto
Label.Caption := IntToStr(Random(VariavelInteiroMáximaquevocequergeraronumerorandomico))
GOSTEI 0
Ricardop
13/03/2003
procure no help por random, randomize, etc...
veja um exemplo retirado do help:
procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
begin
begin
Randomize;
for I := 1 to 50 do begin
{ Write to window at random locations }
Canvas.TextOut([b:db168a0c38]Random[/b:db168a0c38](Width), [b:db168a0c38]Random[/b:db168a0c38](Height), ´ClubeDelphi!´);
end;
end;
end;
end.
[ ]s
veja um exemplo retirado do help:
procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
begin
begin
Randomize;
for I := 1 to 50 do begin
{ Write to window at random locations }
Canvas.TextOut([b:db168a0c38]Random[/b:db168a0c38](Width), [b:db168a0c38]Random[/b:db168a0c38](Height), ´ClubeDelphi!´);
end;
end;
end;
end.
[ ]s
GOSTEI 0