Skip to content

RandomFrom

Return a random element of an array of numbers.

Declaration

Source position: math.pp line 966

function RandomFrom(const AValues: Array of Single) : Single;  overload; overload;
function RandomFrom(const AValues: Array of Double) : Double;  overload; overload;
function RandomFrom(const AValues: Array of Extended) : Extended
                   ;  overload; overload;
function RandomFrom(const AValues: Array of Integer) : Integer
                   ;  overload; overload;
function RandomFrom(const AValues: Array of Int64) : Int64;  overload; overload;

Description

RandomFrom returns a random element from the array AValues. The return value has the same type as the type of the array elements.

See also

Name Description
#rtl.system.Random Generate random number.
RandomRange Return a random number in a range.