System.Math.RandomRange
Delphi
function RandomRange(const AFrom, ATo: Integer): Integer;
C++
extern DELPHI_PACKAGE int __fastcall RandomRange(const int AFrom, const int ATo);
Propriétés
Type | Visibilité | Source | Unité | Parent |
---|---|---|---|---|
function | public | System.Math.pas System.Math.hpp |
System.Math | System.Math |
Description
Renvoie un entier choisi au hasard dans l'intervalle spécifié.
RandomRange renvoie un entier aléatoire appartenant à l'intervalle compris entre AFrom et ATo (bornes non incluses). RandomRange peut utiliser des intervalles négatifs (où AFrom est supérieur à ATo).
Pour initialiser le générateur de nombre aléatoire, ajoutez un seul appel Randomize ou affectez une valeur à la variable RandSeed avant d'effectuer un appel à RandomRange.