Displaying 1 result from an estimated 1 matches for "unirand".
2015 Sep 04
0
getting a vector of unown size
...necessary to hold
the result and then shrink the vector to the size where meaningful
values occur, but this waste much resources and time unnecessarily.
The C code
#include <stdlib.h>
#include <math.h>
double min(double a, double b)
{
if(a>b)
return b;
else
return a;
}
double unirand()
{
return (rand()+1.0)/(RAND_MAX+1.0);
}
void RndSBDdemography(double *b, double *d, double *a, double *c, double
*No, double *tmax, double *tiempo, double *Nind)
{
double tb, td, n;
int bc=0;
tiempo[0]=1.0;
Nind[0] = *No;
// This loop generates output of variable and a priori unknown size
whi...