DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....


RandomFillIntArray

Declaration: RandomFillIntArray (var Arr: TIntArray; RangeLow, RangeHigh: integer; DupsAllowed: boolean): integer;
The function RandomFillIntArray fills every cell of the integer array Arr with a random number with uniform distribution. The generated random numbers are in the range from RangeLow to RangeHigh. The function provides an option to fill the integer array with unique, non-repeating random numbers by setting the paramter DupsAllowed to FALSE. Please note that there are some restrictions on the parameters if DupsAllowed is set to FALSE: the maximum size of the array is limited to 1000000 entries and the range of the random numbers must not exceed 1000000.

The function returns the following error codes:

 0 ... everything is OK
-1 ... the matrix Arr has zero size
-2 ... RangeLow is greater than RangeHigh
-3 ... the range of the random numbers is too small, the array cannot be filled without creating duplicates
-4 ... the range of the random numbers is too big (currently limited to 1000000)