System.StrUtils.RandomFrom

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

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

C++

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

Properties

Type Visibility Source Unit Parent
function public
System.StrUtils.pas
System.StrUtils.hpp
System.StrUtils System.StrUtils

Description

Returns a randomly selected element from an array.

RandomFrom returns a randomly selected element from the array passed as the AValues argument. In C++, AValues_Size is the index of the last array element (one less than the number of elements.)

To initialize the random number generator, add a single call Randomize or assign a value to the RandSeed variable before making any calls to RandomFrom.

See Also