RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
StrUtils.RandomFrom Function

Returns a randomly selected element from an array.

Pascal
function RandomFrom(const AValues: array of string): string; overload;
C++
AnsiString RandomFrom(const array of string AValues);

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. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!