Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RooRandom.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooRandom.h,v 1.9 2007/05/11 09:11:30 verkerke Exp $
5  * Authors: *
6  * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7  * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8  * *
9  * Copyright (c) 2000-2005, Regents of the University of California *
10  * and Stanford University. All rights reserved. *
11  * *
12  * Redistribution and use in source and binary forms, *
13  * with or without modification, are permitted according to the terms *
14  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15  *****************************************************************************/
16 #ifndef ROO_RANDOM
17 #define ROO_RANDOM
18 
19 #include "Rtypes.h"
20 #include "TRandom.h"
21 
22 class RooQuasiRandomGenerator;
23 
24 class RooRandom {
25 public:
26 
27  virtual ~RooRandom() {} ;
28 
29  static TRandom *randomGenerator();
30  static void setRandomGenerator(TRandom* gen);
31  static Double_t uniform(TRandom *generator= randomGenerator());
32  static void uniform(UInt_t dimension, Double_t vector[], TRandom *generator= randomGenerator());
33  static UInt_t integer(UInt_t max, TRandom *generator= randomGenerator());
34  static Double_t gaussian(TRandom *generator= randomGenerator());
35 
36  static RooQuasiRandomGenerator *quasiGenerator();
37  static Bool_t quasi(UInt_t dimension, Double_t vector[],
38  RooQuasiRandomGenerator *generator= quasiGenerator());
39 
40 private:
41  RooRandom();
42 
43  static TRandom* _theGenerator; // random number generator
44  static RooQuasiRandomGenerator* _theQuasiGenerator; // quasi random number sequence generator
45 
46  // free resources when library is unloaded
47  struct Guard { ~Guard(); };
48  static struct Guard guard;
49  friend struct RooRandom::Guard;
50 
51  ClassDef(RooRandom,0) // Random number generator interface
52 };
53 
54 #endif