2.1.24.8.1 bernrnd
Contents
Description
Generates an array of random integers from a bernoulli distribution
Syntax
int bernrnd( int * v, uint n, double p)
Parameters
- v
- [output] Pointer to a int array, which contain the results
- n
- [input] The number of pseudo-random numbers to be generated. n>=1
- p
- [input] The probability of success p of the bernoulli distribution
Return
Return NE_NOERROR(0) on success, otherwise error.
Examples
EX
void test_bernrnd() { int n = 20; vector<int> vd(n); int nRet = bernrnd(vd, n, 0.15); for (int i = 0; i < n; i++) { printf("%d\n", vd[i]); } }
Remark
See Also
Header to Include
origin.h