Index: /trunk/SophyaLib/NTools/Makefile
===================================================================
--- /trunk/SophyaLib/NTools/Makefile	(revision 3600)
+++ /trunk/SophyaLib/NTools/Makefile	(revision 3601)
@@ -1,4 +1,4 @@
 include ../BuildMgr/sophyamake.inc
-
+ 
 all: $(SOPHYALIBP)libNTools.a
  
@@ -694,5 +694,33 @@
   $(SOPHYAINCP)machdefs.h \
   $(SOPHYAINCP)pexceptions.h \
-  $(SOPHYAINCP)machdefs.h pemath.h
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)randr48.h \
+  $(SOPHYAINCP)objfio.h \
+  $(SOPHYAINCP)anydataobj.h \
+  $(SOPHYAINCP)ppersist.h \
+  $(SOPHYAINCP)pexceptions.h \
+  $(SOPHYAINCP)gnumd5.h \
+  $(SOPHYAINCP)ppfbinstream.h \
+  $(SOPHYAINCP)rawstream.h \
+  $(SOPHYAINCP)ppfnametag.h \
+  $(SOPHYAINCP)ndatablock.h \
+  $(SOPHYAINCP)randinterf.h tsfunran.h \
+  $(SOPHYAINCP)histos.h \
+  $(SOPHYAINCP)peida.h \
+  $(SOPHYAINCP)utils.h \
+  $(SOPHYAINCP)perrors.h \
+  $(SOPHYAINCP)fmath.h \
+  $(SOPHYAINCP)tvector.h \
+  $(SOPHYAINCP)tmatrix.h \
+  $(SOPHYAINCP)tarray.h \
+  $(SOPHYAINCP)basarr.h \
+  $(SOPHYAINCP)mutyv.h \
+  $(SOPHYAINCP)timestamp.h \
+  $(SOPHYAINCP)dvlist.h \
+  $(SOPHYAINCP)utilarr.h \
+  $(SOPHYAINCP)tmatrix_tsnl.h \
+  $(SOPHYAINCP)tvector_tsnl.h \
+  $(SOPHYAINCP)tvector.h \
+  $(SOPHYAINCP)randinterf.h classfunc.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  tsfunran.cc
  
Index: /trunk/SophyaLib/NTools/smakefile
===================================================================
--- /trunk/SophyaLib/NTools/smakefile	(revision 3600)
+++ /trunk/SophyaLib/NTools/smakefile	(revision 3601)
@@ -694,5 +694,33 @@
   $(SOPHYAINCP)machdefs.h \
   $(SOPHYAINCP)pexceptions.h \
-  $(SOPHYAINCP)machdefs.h pemath.h
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)randr48.h \
+  $(SOPHYAINCP)objfio.h \
+  $(SOPHYAINCP)anydataobj.h \
+  $(SOPHYAINCP)ppersist.h \
+  $(SOPHYAINCP)pexceptions.h \
+  $(SOPHYAINCP)gnumd5.h \
+  $(SOPHYAINCP)ppfbinstream.h \
+  $(SOPHYAINCP)rawstream.h \
+  $(SOPHYAINCP)ppfnametag.h \
+  $(SOPHYAINCP)ndatablock.h \
+  $(SOPHYAINCP)randinterf.h tsfunran.h \
+  $(SOPHYAINCP)histos.h \
+  $(SOPHYAINCP)peida.h \
+  $(SOPHYAINCP)utils.h \
+  $(SOPHYAINCP)perrors.h \
+  $(SOPHYAINCP)fmath.h \
+  $(SOPHYAINCP)tvector.h \
+  $(SOPHYAINCP)tmatrix.h \
+  $(SOPHYAINCP)tarray.h \
+  $(SOPHYAINCP)basarr.h \
+  $(SOPHYAINCP)mutyv.h \
+  $(SOPHYAINCP)timestamp.h \
+  $(SOPHYAINCP)dvlist.h \
+  $(SOPHYAINCP)utilarr.h \
+  $(SOPHYAINCP)tmatrix_tsnl.h \
+  $(SOPHYAINCP)tvector_tsnl.h \
+  $(SOPHYAINCP)tvector.h \
+  $(SOPHYAINCP)randinterf.h classfunc.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  tsfunran.cc
  
Index: /trunk/SophyaLib/NTools/tsfunran.cc
===================================================================
--- /trunk/SophyaLib/NTools/tsfunran.cc	(revision 3600)
+++ /trunk/SophyaLib/NTools/tsfunran.cc	(revision 3601)
@@ -1,7 +1,8 @@
 #include "sopnamsp.h"
 #include "machdefs.h"
+#include <iostream>
 #include "pexceptions.h"
+#include "randr48.h"
 #include "tsfunran.h"
-#include <iostream>
 
 
@@ -43,10 +44,10 @@
 */
 TsFunRan::TsFunRan(TsFunRan::Func f, r_8 xMin, r_8 xMax, int_4 nBin, bool pdf)
-  : Histo(xMin,xMax,nBin)
+  : Histo(xMin,xMax,nBin), rg_(NULL), internal_rg_(false)
 {
  if(nBin<=1)
    throw RangeCheckError("TsFunRan::TsFunRan less than 2 bins requested");
  for(int_4 i=0;i<nBin;i++) (*this)(i) = f(BinCenter(i));
- rg_ = new RandomGenerator(1,false);
+ rg_ = new DR48RandGen();
  create_DF(pdf);
 }
@@ -57,10 +58,10 @@
 */
 TsFunRan::TsFunRan(ClassFunc& f, r_8 xMin, r_8 xMax, int_4 nBin, bool pdf)
-  : Histo(xMin,xMax,nBin)
+  : Histo(xMin,xMax,nBin), rg_(NULL), internal_rg_(false)
 {
  if(nBin<=1)
    throw RangeCheckError("TsFunRan::TsFunRan less than 2 bins requested");
  for(int_4 i=0;i<nBin;i++) (*this)(i) = f(BinCenter(i));
- rg_ = new RandomGenerator(1,false);
+ rg_ = new DR48RandGen();
  create_DF(pdf);
 }
@@ -74,10 +75,10 @@
 */
 TsFunRan::TsFunRan(r_8 *tab, int_4 nBin, bool pdf)
-: Histo(-0.5,nBin-0.5,nBin)
+: Histo(-0.5,nBin-0.5,nBin), rg_(NULL), internal_rg_(false)
 {
  if(nBin<=1)
    throw RangeCheckError("TsFunRan::TsFunRan less than 2 bins requested");
  for(int_4 i=0;i<nBin;i++) (*this)(i) = tab[i];
- rg_ = new RandomGenerator(1,false);
+ rg_ = new DR48RandGen();
  create_DF(pdf);
 }
@@ -92,10 +93,10 @@
 */
 TsFunRan::TsFunRan(r_8 *tab, int_4 nBin, r_8 xMin, r_8 xMax, bool pdf)
-: Histo(xMin,xMax,nBin)
+: Histo(xMin,xMax,nBin), rg_(NULL), internal_rg_(false)
 {
  if(nBin<=1)
    throw RangeCheckError("TsFunRan::TsFunRan less than 2 bins requested");
  for(int_4 i=0;i<nBin;i++) (*this)(i) = tab[i];
- rg_ = new RandomGenerator(1,false);
+ rg_ = new DR48RandGen();
  create_DF(pdf);
 }
@@ -105,10 +106,10 @@
 */
 TsFunRan::TsFunRan(TVector<r_8>& tab, int_4 nBin, bool pdf)
-: Histo(-0.5,nBin-0.5,nBin)
+: Histo(-0.5,nBin-0.5,nBin), rg_(NULL), internal_rg_(false)
 {
  if(nBin<=1)
    throw RangeCheckError("TsFunRan::TsFunRan less than 2 bins requested");
  for(int_4 i=0;i<nBin;i++) (*this)(i) = tab(i);
- rg_ = new RandomGenerator(1,false);
+ rg_ = new DR48RandGen();
  create_DF(pdf);
 }
@@ -118,10 +119,10 @@
 */
 TsFunRan::TsFunRan(TVector<r_8>& tab, int_4 nBin, r_8 xMin, r_8 xMax, bool pdf)
-: Histo(xMin,xMax,nBin)
+: Histo(xMin,xMax,nBin), rg_(NULL), internal_rg_(false)
 {
  if(nBin<=1)
    throw RangeCheckError("TsFunRan::TsFunRan less than 2 bins requested");
  for(int_4 i=0;i<nBin;i++) (*this)(i) = tab(i);
- rg_ = new RandomGenerator(1,false);
+ rg_ = new DR48RandGen();
  create_DF(pdf);
 }
@@ -134,9 +135,9 @@
 */
 TsFunRan::TsFunRan(Histo &h, bool pdf)
-  : Histo(h)
+  : Histo(h), rg_(NULL), internal_rg_(false)
 {
  if(mBins<=1)
    throw RangeCheckError("TsFunRan::TsFunRan less than 2 bins requested");
- rg_ = new RandomGenerator(1,false);
+ rg_ = new DR48RandGen();
  create_DF(pdf);
 }
@@ -145,7 +146,6 @@
 /*! Creator by copy */
 TsFunRan::TsFunRan(const TsFunRan& fh)
-  : Histo(fh)
-{
-  rg_ = new RandomGenerator(*fh.rg_);
+  : Histo(fh), rg_(fh.rg_), internal_rg_(false)
+{
 }
 
@@ -153,6 +153,6 @@
 /*! Creator by default */
 TsFunRan::TsFunRan(void)
-{
-  rg_ = new RandomGenerator(1,false);
+  : rg_(NULL), internal_rg_(false)
+{
 }
 
@@ -160,5 +160,5 @@
 TsFunRan::~TsFunRan(void)
 {
-  if(rg_!=NULL) delete rg_;
+  if(rg_!=NULL && internal_rg_) delete rg_;
 }
 
@@ -180,8 +180,8 @@
 
 /********* Methode *********/
-void TsFunRan::SetRandomGenerator(RandomGenerator& rg)
-{
-  if(rg_!=NULL) delete rg_;
-  rg_ = new RandomGenerator(rg);
+void TsFunRan::SetRandomGenerator(RandomGeneratorInterface* rg)
+{
+  if(rg_!=NULL && internal_rg_) delete rg_;
+  rg_ = rg;
 }
 
Index: /trunk/SophyaLib/NTools/tsfunran.h
===================================================================
--- /trunk/SophyaLib/NTools/tsfunran.h	(revision 3600)
+++ /trunk/SophyaLib/NTools/tsfunran.h	(revision 3601)
@@ -12,5 +12,5 @@
 #include "histos.h"
 #include "tvector.h"
-#include "stsrand.h"
+#include "randinterf.h"
 #include "classfunc.h"
 
@@ -31,5 +31,5 @@
   virtual ~TsFunRan(void);
 
-  void SetRandomGenerator(RandomGenerator& rg);
+  void SetRandomGenerator(RandomGeneratorInterface* rg);
 
   int_4 BinRandom(void);
@@ -38,5 +38,6 @@
 protected:
   void create_DF(bool pdf);
-  RandomGenerator* rg_;
+  RandomGeneratorInterface* rg_;
+  bool internal_rg_;
 };
 
