2.1.24.8.7 disrnd2
Contents
Description
Use disrnd to generate random numbers to reorder given array
Syntax
int disrnd2( double * v, uint n, const double * vValues, const double * vP, const uint nSizeP )
Parameters
- v
- [output] Pointer to a double array, which contain the results
- n
- [input] The number of pseudo-random numbers to be generated. n>=1
- vValues
- [input] Pointer to a double array for reordering
- vP
- [input] The PDF or CDF of the distribution
- nSizeP
- [input] The number of values supplied in p defining the PDF or CDF of the discrete distribution
Return
Return NE_NOERROR(0) on success, otherwise error.
Examples
EX
void disrnd2_ex() { vector vP = {0.1,0.4,0.5}; vector vValues = {10,20,30}; int n = 100; vector<double> vd(n); int nRet = disrnd2(vd, vd.GetSize(), vValues, vP, vP.GetSize()); for (int i = 0; i < n; i++) { printf("%g\n", vd[i]); } }
Remark
See Also
Header to Include
origin.h