【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.2.3.19.28 vectorbase::Normal
Contents
Description
Fill vector with pseudorandom numbers from a normal distribution.
Syntax
BOOL Normal( int nSize, int nSeed = 0 )
Parameters
- nSize
- [input] number of values
- nSeed
- [input] seed for the random sequence. Using a value of 0 will generate a different sequence each time this function is called. The same senquence of numbers will be generated each time if the function is called with a fixed seed value larger than 0.
Return
Returns TRUE on success or FALSE on failure.
Examples
EX1
void vectorbase_Normal_ex1() { // Declare a vector of size 20 vector vec(20); // Fill with normal random numbers BOOL bRet = vec.Normal(vec.GetSize()); // Output the values for( int ii=0; ii<vec.GetSize(); ii++ ) printf("vec[%d]=%f\n", ii, vec[ii]) }
Remark
Fill vector with pseudorandom numbers from a normal distribution with zero mean and unit standard deviation. This method is similar to the LabTalk Normal function.
If this method is used on an integer vector, then the resulting vector will be filled with nearest integers from the distribution with typical values betwen -3 and 3.
See Also
Header to Include
origin.h