procedure Randomize; //Initializes the random number generator with a random value. Random function //Generates random numbers within a specified 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;
procedure TForm1.Button1Click(Sender: TObject); begin Randomize; showmessage(inttostr(random(10000)+1)); end;
//Initializes the random number generator with a random value.
Random function
//Generates random numbers within a specified 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;
begin
Randomize;
showmessage(inttostr(random(10000)+1));
end;