laura is hosted by Hepforge, IPPP Durham
Laura++  v1r0
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauRandom.cc
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2005 - 2013.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 // Authors:
7 // Thomas Latham
8 // John Back
9 // Paul Harrison
10 
16 #include "LauRandom.hh"
17 
18 #include "TRandom3.h"
19 
21 {
22  // Returns a pointer to a singleton random-number generator implementation.
23  // Creates the object the first time it is called.
24 
25  static TRandom* theGenerator = 0;
26  if (theGenerator == 0) {theGenerator = new TRandom3(65539);}
27  return theGenerator;
28 }
29 
31 {
32  // Returns a pointer to a singleton random-number generator implementation.
33  // Creates the object the first time it is called.
34 
35  static TRandom* theGenerator = 0;
36  if (theGenerator == 0) {theGenerator = new TRandom3(0);}
37  // Use TRandom3(0) to set seed from machine clock time (within +-1 sec).
38  return theGenerator;
39 }
40 
41 void LauRandom::setSeed(UInt_t seed)
42 {
43  TRandom* theGenerator = randomFun();
44  theGenerator->SetSeed(seed);
45 }
46 
TRandom * randomFun()
Access the singleton random number generator with a particular seed.
Definition: LauRandom.cc:20
TRandom * zeroSeedRandom()
Access the singleton random number generator with seed set from machine clock time (within +-1 sec)...
Definition: LauRandom.cc:30
void setSeed(UInt_t seed)
Set seed of random-number generator to a given value.
Definition: LauRandom.cc:41
File containing LauRandom namespace.