]> git.treefish.org Git - phys/u1casc.git/commitdiff
Using microseconds for random seed.
authorAlexander Schmidt <alex@treefish.org>
Sun, 16 Feb 2014 23:15:25 +0000 (00:15 +0100)
committerAlexander Schmidt <alex@treefish.org>
Sun, 16 Feb 2014 23:15:25 +0000 (00:15 +0100)
u1casc-ordinary/sim.hpp

index af989c93c0b4f221f6d920f34133fa0201c36310..f88e650d6c2bc407b5aa44565a431040ed5e7591 100644 (file)
@@ -4,6 +4,7 @@
 #include <gsl/gsl_rng.h>
 #include <complex>
 #include <math.h>
+#include <sys/time.h>
 
 #include "latlib/neigh.h"
 
@@ -32,6 +33,8 @@ sim::sim(o815 *_O815) : o815::sim( _O815,
                                   sizeof(complex<double>)*
                                   _O815->comargs.lsize[0]*_O815->comargs.lsize[0]*_O815->comargs.lsize[0]*_O815->comargs.lsize[1]*(2+4) ) {
 
+  struct timeval tv;
+
   lsize4 = _O815->comargs.lsize[0]*_O815->comargs.lsize[0]*_O815->comargs.lsize[0]*_O815->comargs.lsize[1];
 
   nb = new neigh(4, _O815->comargs.lsize[0], _O815->comargs.lsize[0], _O815->comargs.lsize[0], _O815->comargs.lsize[1]);
@@ -39,8 +42,9 @@ sim::sim(o815 *_O815) : o815::sim( _O815,
   phi = (complex<double>*)confMem;
   U = (complex<double>*)(confMem + sizeof(complex<double>)*lsize4*2);
 
+  gettimeofday(&tv, NULL);
   rangsl = gsl_rng_alloc(gsl_rng_ranlxs0);
-  gsl_rng_set(rangsl, time(NULL));
+  gsl_rng_set(rangsl, 1000000 * tv.tv_sec + tv.tv_usec);
 }
 
 void sim::_makeSweep() {