Link to home
Start Free TrialLog in
Avatar of alpires
alpiresFlag for Brazil

asked on

Math.random() to Delphi

Hi Experts,

How to convert this function "Math.random()" (javascript) to delphi ?

Thanks for some help
Avatar of jimyX
jimyX

There is a Random function in Delphi under the System Unit:
procedure TForm1.Button1Click(Sender: TObject);
begin
  Randomize;
  showmessage(inttostr(Random(10)));
end;

Open in new window


When you call Random(x) then the possible result will be between 0 and x-1.
ASKER CERTIFIED SOLUTION
Avatar of rinfo
rinfo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial