RandomRange function Delphi has a great function that Lazarus lacks; the ability to return a random number within a set range. However, this little function will do the job really well.
Declare the following in the public section,
function RandomRange(aMin: Integer; aMax: Integer) : Integer;
Now add this to your implementation section
function TForm1.RandomRange(aMin: Integer; aMax: Integer) : Integer; begin RandomRange := Random(aMax-aMin) + aMin ; end;
Usage is very simple,
declare a variable, say aNum and then use like this,