System.Math.RandomRange
Delphi
function RandomRange(const AFrom, ATo: Integer): Integer;
C++
extern DELPHI_PACKAGE int __fastcall RandomRange(const int AFrom, const int ATo);
プロパティ
種類 | 可視性 | ソース | ユニット | 親 |
---|---|---|---|---|
function | public | System.Math.pas System.Math.hpp |
System.Math | System.Math |
説明
指定された範囲内の乱数整数を返します。
RandomRange は、AFrom から ATo まで(両端を含まない)の範囲内の乱数整数を返します。RandomRange は負の範囲(AFrom が ATo より大きい)を扱えます。
乱数ジェネレータを初期化するには、RandomRange を呼び出す前に、Randomize を 1 回呼び出すか RandSeed 変数に値を代入します。