jeudi 20 août 2015

Generate Random Number between 2 constraints Delphi XE 8 - Firemonkey

I know the code from the Standard Delphi programming goes like this:

randomize();
i := random(5,10); // where i is an integer.

Then the value of i will be between 5 and 10. However how would I do that in Fire Monkey. The function requires a range but I have no idea how to create the range.

Searching Google or event the documents on embarcadero's website has been of no help either.

The function looks like this: function Random(const ARange: Integer): Integer;

Is this even possible, or am I looking the wrong places? Should I rather write a function like this:

while ((i<= 64) and (i>= 91)) do
    i := Random(90);




Aucun commentaire:

Enregistrer un commentaire