about summary refs log tree commit diff
path: root/src/bslmm.cpp
diff options
context:
space:
mode:
authorPjotr Prins2020-11-28 14:39:05 +0000
committerPjotr Prins2020-11-29 08:50:44 +0000
commit4a56c11c95e9f13670c906b353fe9360344eb913 (patch)
treecc338502b5066fd15217eae948df1b9382c5a049 /src/bslmm.cpp
parentad2d303ebf4999a9e4833beb73a4bc6f0dee4952 (diff)
downloadpangemma-4a56c11c95e9f13670c906b353fe9360344eb913.tar.gz
Sane random generator handling
Diffstat (limited to 'src/bslmm.cpp')
-rw-r--r--src/bslmm.cpp33
1 files changed, 3 insertions, 30 deletions
diff --git a/src/bslmm.cpp b/src/bslmm.cpp
index 3305639..eb961e9 100644
--- a/src/bslmm.cpp
+++ b/src/bslmm.cpp
@@ -84,7 +84,8 @@ void BSLMM::CopyFromParam(PARAM &cPar) {
   w_pace = cPar.w_pace;
   n_mh = cPar.n_mh;
   geo_mean = cPar.geo_mean;
-  randseed = cPar.randseed;
+  // randseed = cPar.randseed;
+  gsl_r = cPar.gsl_r;
   trace_G = cPar.trace_G;
 
   ni_total = cPar.ni_total;
@@ -107,7 +108,7 @@ void BSLMM::CopyToParam(PARAM &cPar) {
   cPar.cHyp_initial = cHyp_initial;
   cPar.n_accept = n_accept;
   cPar.pheno_mean = pheno_mean;
-  cPar.randseed = randseed;
+  // cPar.randseed = randseed;
 
   return;
 }
@@ -938,19 +939,6 @@ void BSLMM::MCMC(const gsl_matrix *U, const gsl_matrix *UtX,
 
   // Calculate proposal distribution for gamma (unnormalized),
   // and set up gsl_r and gsl_t.
-  gsl_rng_env_setup();
-  const gsl_rng_type *gslType;
-  gslType = gsl_rng_default;
-  if (randseed < 0) {
-    time_t rawtime;
-    time(&rawtime);
-    tm *ptm = gmtime(&rawtime);
-
-    randseed =
-        (unsigned)(ptm->tm_hour % 24 * 3600 + ptm->tm_min * 60 + ptm->tm_sec);
-  }
-  gsl_r = gsl_rng_alloc(gslType);
-  gsl_rng_set(gsl_r, randseed);
 
   double *p_gamma = new double[ns_test];
   CalcPgamma(p_gamma);
@@ -1643,21 +1631,6 @@ void BSLMM::MCMC(const gsl_matrix *X, const gsl_vector *y) {
   }
 
   // Calculate proposal distribution for gamma (unnormalized),
-  // and set up gsl_r and gsl_t.
-  gsl_rng_env_setup();
-  const gsl_rng_type *gslType;
-  gslType = gsl_rng_default;
-  if (randseed < 0) {
-    time_t rawtime;
-    time(&rawtime);
-    tm *ptm = gmtime(&rawtime);
-
-    randseed =
-        (unsigned)(ptm->tm_hour % 24 * 3600 + ptm->tm_min * 60 + ptm->tm_sec);
-  }
-  gsl_r = gsl_rng_alloc(gslType);
-  gsl_rng_set(gsl_r, randseed);
-
   double *p_gamma = new double[ns_test];
   CalcPgamma(p_gamma);