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);

StrUtils

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. 

 

Randomize 

RandSeed

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!