From 3ef18f1f5648f25c19b52880a7d5480844909ed0 Mon Sep 17 00:00:00 2001 From: Christian Beckmann <c.beckmann@donders.ru.nl> Date: Thu, 10 Jul 2003 12:59:54 +0000 Subject: [PATCH] changed unifrnd and normrnd to use rand instead of drand --- miscprob.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/miscprob.cc b/miscprob.cc index a57c397..e19ffaa 100644 --- a/miscprob.cc +++ b/miscprob.cc @@ -25,10 +25,10 @@ ReturnMatrix unifrnd(const int dim1, const int dim2, const float start, const fl Matrix res(dim1,tdim); for (int mc=1; mc<=res.Ncols(); mc++) { for (int mr=1; mr<=res.Nrows(); mr++) { - //tmpD = (rand()+1)/double(RAND_MAX+2.0); - //res(mr,mc)=(tmpD)*(end-start)+start; - drand(&tmpD); - res(mr,mc)=(tmpD-1)*(end-start)+start; + tmpD = (rand()+1)/double(RAND_MAX+2.0); + res(mr,mc)=(tmpD)*(end-start)+start; + //drand(&tmpD); + //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 Matrix res(dim1,tdim); for (int mc=1; mc<=res.Ncols(); mc++) { for (int mr=1; mr<=res.Nrows(); mr++) { - //tmpD = (rand()+1)/double(RAND_MAX+2.0); - //res(mr,mc)=ndtri(tmpD)*sigma+mu ; - drand(&tmpD); - res(mr,mc)=ndtri(tmpD-1)*sigma+mu ; + tmpD = (rand()+1)/double(RAND_MAX+2.0); + res(mr,mc)=ndtri(tmpD)*sigma+mu ; + //drand(&tmpD); + //res(mr,mc)=ndtri(tmpD-1)*sigma+mu ; } } -- GitLab