Número randomico
Preciso gerar um número randomico dentro de um intervalo que será definido pelo usuário. utilizei o Random e ele gera sempre o mesmo número...
Me disseram para utilizar o Randomize, mas mesmo assim não deu certo!
Obrigada
Brunika!
Me disseram para utilizar o Randomize, mas mesmo assim não deu certo!
Obrigada
Brunika!
Brunika
Curtidas 0
Respostas
Delphi_user
08/08/2003
:evil:
larga de c preguiçosa e pesquisa menina e ve c aprende direito tah
larga de c preguiçosa e pesquisa menina e ve c aprende direito tah
GOSTEI 0
Ivonei
08/08/2003
Tente esta função: :)
function Random [ ( Range: Integer) ];
0 <= X < Range.
var
I: Integer;
begin
Randomize;
for I := 1 to 50 do begin
{ Write to window at random locations }
Canvas.TextOut(Random(Width), Random(Height), ´Boo!´);
end;
end;
[ ]´s
function Random [ ( Range: Integer) ];
0 <= X < Range.
var
I: Integer;
begin
Randomize;
for I := 1 to 50 do begin
{ Write to window at random locations }
Canvas.TextOut(Random(Width), Random(Height), ´Boo!´);
end;
end;
[ ]´s
GOSTEI 0
Ivonei
08/08/2003
Tente esta função: :)
function Random [ ( Range: Integer) ];
0 <= X < Range.
var
I: Integer;
begin
Randomize;
for I := 1 to 50 do begin
{ Write to window at random locations }
Canvas.TextOut(Random(Width), Random(Height), ´Boo!´);
end;
end;
[ ]´s
function Random [ ( Range: Integer) ];
0 <= X < Range.
var
I: Integer;
begin
Randomize;
for I := 1 to 50 do begin
{ Write to window at random locations }
Canvas.TextOut(Random(Width), Random(Height), ´Boo!´);
end;
end;
[ ]´s
GOSTEI 0
Cebikyn
08/08/2003
Exite um afunção na [i:e47747a476]Unit[/i:e47747a476] [b:e47747a476]Math[/b:e47747a476] que faz exatamente o que vc quer:
Lembre-se de colocar [b:e47747a476]Math[/b:e47747a476] na seção [i:e47747a476]uses[/i:e47747a476].
RandomRange(Inicio_do_Intervalo, Fim_do_Intervalo);
Lembre-se de colocar [b:e47747a476]Math[/b:e47747a476] na seção [i:e47747a476]uses[/i:e47747a476].
GOSTEI 0
Atomix
08/08/2003
Tente utilizar a função random da seguinte forma:
funtion Rnd(nTotal : integer):integer;
begin
Randomize;
Result := Random(nTotal);
end;
:)
funtion Rnd(nTotal : integer):integer;
begin
Randomize;
Result := Random(nTotal);
end;
:)
GOSTEI 0