| VF_random | VD_random | VE_random |
| VCF_random | VCD_random | VCE_random |
| VI_random | VBI_random | VSI_random | VLI_random | VQI_random |
| VU_random | VUB_random | VUS_random | VUL_random | VUI_random |
|
| Function | High-quality random numbers |
|
| Syntax C/C++ | #include <VFstd.h>
long VF_random( fVector X, ui siz, long seed, float MinVal, float MaxVal ); |
| C++ VecObj | #include <OptiVec.h>
long vector<T>::random( long seed, T MinVal, T MaxVal ); |
| Pascal/Delphi | uses VFstd;
function VF_random( X:fVector; size:UInt; seed:LongInt; MinVal, MaxVal:Single ): LongInt; |
|
| Description | The X vector is filled with a sequence of random numbers. Within the ranges defined by MinVal and MaxVal, and within the restrictions of floating-point representation, all numbers are equally probable (including the extreme values themselves), i.e., so-called "uniform deviates" are produced. The parameter seed may be any number. Successive calls to one and the same of these functions will yield identical sequences, if seed is chosen equal; if seed is chosen differently for successive calls, the results will be uncorrelated.
Internally, these functions employ a 32-bit integer random number generator by H.W.Lewis, with additional steps (so-called "Bays-Durham shuffle") to break sequential correlations. This ensures very good randomness, far superior to simpler generators (like the rand function of C/C++ compilers or the random function of Pascal/Delphi).
A long value is returned which may be used as new seed for subsequent calls. |
|
|
| Return value | last 32-bit random number generated; this may be used as a new seed value for future calls. |
|
| See also | VF_noise, rand, srand (C/C++ only), random |
|