laura is hosted by Hepforge, IPPP Durham
Laura++  v3r4
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauRandom.cc
Go to the documentation of this file.
1 
2 /*
3 Copyright 2005 University of Warwick
4 
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8 
9  http://www.apache.org/licenses/LICENSE-2.0
10 
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 */
17 
18 /*
19 Laura++ package authors:
20 John Back
21 Paul Harrison
22 Thomas Latham
23 */
24 
30 #include "LauRandom.hh"
31 
32 #include "TRandom3.h"
33 
35 {
36  // Returns a pointer to a singleton random-number generator implementation.
37  // Creates the object the first time it is called.
38 
39  static TRandom* theGenerator = 0;
40  if (theGenerator == 0) {theGenerator = new TRandom3(65539);}
41  return theGenerator;
42 }
43 
45 {
46  // Returns a pointer to a singleton random-number generator implementation.
47  // Creates the object the first time it is called.
48 
49  static TRandom* theGenerator = 0;
50  if (theGenerator == 0) {theGenerator = new TRandom3(0);}
51  // Use TRandom3(0) to set seed from machine clock time (within +-1 sec).
52  return theGenerator;
53 }
54 
55 void LauRandom::setSeed(UInt_t seed)
56 {
57  TRandom* theGenerator = randomFun();
58  theGenerator->SetSeed(seed);
59 }
60 
TRandom * randomFun()
Access the singleton random number generator with a particular seed.
Definition: LauRandom.cc:34
TRandom * zeroSeedRandom()
Access the singleton random number generator with seed set from machine clock time (within +-1 sec)...
Definition: LauRandom.cc:44
void setSeed(UInt_t seed)
Set seed of random-number generator to a given value.
Definition: LauRandom.cc:55
File containing LauRandom namespace.