نوشته شده توسط
رامین.
در صورت امکان بشتر توضیح دهید
:shock:
نگاه کنید به راهنمای دلفی :)
delphi help
Random function :arrow:
Randomize procedure :arrow:
Delphi syntax:
function Random [ ( Range: Integer) ];
Description
In Delphi code, Random returns a random number within the range 0 <= X < Range. If Range is not specified, the result is a real-type random number within the range
0 <= X < 1.
To initialize the random number generator, add a single call Randomize or assign a value to the RandSeed variable before making any calls to Random.
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 Randomize;
...
Randomize initializes the built-in random number generator with a random value (obtained from the system clock). The random number generator should be initialized by making a call to Randomize, or by assigning a value to RandSeed.