System.Math.RandomRange
Delphi
function RandomRange(const AFrom, ATo: Integer): Integer;
C++
extern DELPHI_PACKAGE int __fastcall RandomRange(const int AFrom, const int ATo);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.Math.pas System.Math.hpp |
System.Math | System.Math |
Description
Returns a random integer from a specified range.
RandomRange returns a random integer from the range that extends between AFrom and ATo (non-inclusive). RandomRange can handle negative ranges (where AFrom is greater than ATo).
To initialize the random number generator, add a single call Randomize or assign a value to the RandSeed variable before making any calls to RandomRange.