CMS 3D CMS Logo

SprRandomNumber.cc

Go to the documentation of this file.
00001 //$Id: SprRandomNumber.cc,v 1.2 2007/09/21 22:32:10 narsky Exp $
00002 
00003 #include "PhysicsTools/StatPatternRecognition/interface/SprExperiment.hh"
00004 #include "PhysicsTools/StatPatternRecognition/interface/SprRandomNumber.hh"
00005 
00006 #include <sys/time.h>
00007 
00008 using namespace std;
00009 
00010 int SprRandomNumber::timeSeed(int seed)
00011 {
00012   if( seed < 0 ) {
00013     struct timeval tp;
00014     gettimeofday(&tp, 0);
00015     return tp.tv_usec;
00016   }
00017   return seed;
00018 }
00019 
00020 void SprRandomNumber::init(int seed)
00021 {
00022   theRanluxEngine_.setSeed(this->timeSeed(seed));
00023 }
00024 
00025 void SprRandomNumber::sequence(double* seq, int npts)
00026 {
00027   // make array of uniform random numbers on [0,1]
00028 
00029   theRanluxEngine_.flatArray(npts, seq);
00030 }

Generated on Tue Jun 9 17:42:03 2009 for CMSSW by  doxygen 1.5.4