System.Math.RandomFrom

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function RandomFrom(const AValues: array of Integer): Integer;
function RandomFrom(const AValues: array of Int64): Int64;
function RandomFrom(const AValues: array of UInt64): UInt64;
function RandomFrom(const AValues: array of Single): Single;
function RandomFrom(const AValues: array of Double): Double;
function RandomFrom(const AValues: array of Extended): Extended;

C++

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

Properties

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

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