System.Math.RandomFrom

De RAD Studio API Documentation
Aller à : navigation, rechercher

Delphi

function RandomFrom(const AValues: array of Integer): Integer;
function RandomFrom(const AValues: array of Int64): Int64;
function RandomFrom(const AValues: array of UInt64): UInt64;
function RandomFrom(const AValues: array of Single): Single;
function RandomFrom(const AValues: array of Double): Double;
function RandomFrom(const AValues: array of Extended): Extended;

C++

extern DELPHI_PACKAGE int __fastcall RandomFrom(const int *AValues, const int AValues_High)/* overload */;

Propriétés

Type Visibilité  Source Unité  Parent
function public
System.Math.pas
System.Math.hpp
System.Math System.Math

Description

Renvoie un élément choisi au hasard dans un tableau.

RandomFrom renvoie un élément choisi au hasard dans le tableau AValues transmis comme argument. Dans C++, AValues_Size est l'indice du dernier élément du tableau (nombre d'éléments moins un).

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 à RandomFrom.

Voir aussi