| MF_random
| MD_random |
ME_random |
| MCF_random |
MCD_random |
MCE_random |
|
| Function | fill a matrix with high-quality random numbers |
|
| Syntax C/C++ | #include <MFstd.h>
long MF_random( fMatrix MA, unsigned ht, unsigned len, long seed, float MinVal, float MaxVal ); |
| C++ MatObj | #include <OptiVec.h>
long matrix<T>::random( const long& seed, const T& MinVal, const T& MaxVal ); |
| Pascal/Delphi | uses MFstd;
function MF_random( MA:fMatrix; ht, len:UInt; seed:LongInt; MinVal, MaxVal:Single ): LongInt; |
|
| Description | The matrix MA is filled with 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. |
|
|