System.StrUtils.RandomFrom

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

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

C++

extern DELPHI_PACKAGE System::UnicodeString __fastcall RandomFrom(System::UnicodeString const *AValues, const int 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