System.StrUtils.RandomFrom

De RAD Studio API Documentation
Aller à : navigation, rechercher

Delphi

function RandomFrom(const AValues: array of string): string;

C++

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

Propriétés

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

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