Skip to content
Snippets Groups Projects
Commit 3ef18f1f authored by Christian Beckmann's avatar Christian Beckmann
Browse files

changed unifrnd and normrnd to use rand instead of drand

parent 7ef96bb3
No related branches found
Tags fsl-3_1 fsl-3_1_1
No related merge requests found
...@@ -25,10 +25,10 @@ ReturnMatrix unifrnd(const int dim1, const int dim2, const float start, const fl ...@@ -25,10 +25,10 @@ ReturnMatrix unifrnd(const int dim1, const int dim2, const float start, const fl
Matrix res(dim1,tdim); Matrix res(dim1,tdim);
for (int mc=1; mc<=res.Ncols(); mc++) { for (int mc=1; mc<=res.Ncols(); mc++) {
for (int mr=1; mr<=res.Nrows(); mr++) { for (int mr=1; mr<=res.Nrows(); mr++) {
//tmpD = (rand()+1)/double(RAND_MAX+2.0); tmpD = (rand()+1)/double(RAND_MAX+2.0);
//res(mr,mc)=(tmpD)*(end-start)+start; res(mr,mc)=(tmpD)*(end-start)+start;
drand(&tmpD); //drand(&tmpD);
res(mr,mc)=(tmpD-1)*(end-start)+start; //res(mr,mc)=(tmpD-1)*(end-start)+start;
} }
} }
...@@ -44,10 +44,10 @@ ReturnMatrix normrnd(const int dim1, const int dim2, const float mu, const float ...@@ -44,10 +44,10 @@ ReturnMatrix normrnd(const int dim1, const int dim2, const float mu, const float
Matrix res(dim1,tdim); Matrix res(dim1,tdim);
for (int mc=1; mc<=res.Ncols(); mc++) { for (int mc=1; mc<=res.Ncols(); mc++) {
for (int mr=1; mr<=res.Nrows(); mr++) { for (int mr=1; mr<=res.Nrows(); mr++) {
//tmpD = (rand()+1)/double(RAND_MAX+2.0); tmpD = (rand()+1)/double(RAND_MAX+2.0);
//res(mr,mc)=ndtri(tmpD)*sigma+mu ; res(mr,mc)=ndtri(tmpD)*sigma+mu ;
drand(&tmpD); //drand(&tmpD);
res(mr,mc)=ndtri(tmpD-1)*sigma+mu ; //res(mr,mc)=ndtri(tmpD-1)*sigma+mu ;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment