laura is hosted by Hepforge, IPPP Durham
Laura++  3.6.0
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 
29 #include "LauRandom.hh"
30 
31 #include "TRandom3.h"
32 
34 {
35  // Returns a pointer to a singleton random-number generator implementation.
36  // Creates the object the first time it is called.
37 
38  static TRandom* theGenerator = 0;
39  if ( theGenerator == 0 ) {
40  theGenerator = new TRandom3( 65539 );
41  }
42  return theGenerator;
43 }
44 
46 {
47  // Returns a pointer to a singleton random-number generator implementation.
48  // Creates the object the first time it is called.
49 
50  static TRandom* theGenerator = 0;
51  if ( theGenerator == 0 ) {
52  theGenerator = new TRandom3( 0 );
53  }
54  // Use TRandom3(0) to set seed from machine clock time (within +-1 sec).
55  return theGenerator;
56 }
57 
58 void LauRandom::setSeed( UInt_t seed )
59 {
60  TRandom* theGenerator = randomFun();
61  theGenerator->SetSeed( seed );
62 }
File containing LauRandom namespace.
TRandom * randomFun()
Access the singleton random number generator with a particular seed.
Definition: LauRandom.cc:33
void setSeed(UInt_t seed)
Set seed of random-number generator to a given value.
Definition: LauRandom.cc:58
TRandom * zeroSeedRandom()
Access the singleton random number generator with seed set from machine clock time (within +-1 sec).
Definition: LauRandom.cc:45