Geant4  10.00.p01
G4INCLRandom.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // INCL++ intra-nuclear cascade model
27 // Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
28 // Davide Mancusi, CEA
29 // Alain Boudard, CEA
30 // Sylvie Leray, CEA
31 // Joseph Cugnon, University of Liege
32 //
33 #define INCLXX_IN_GEANT4_MODE 1
34 
35 #include "globals.hh"
36 
37 /*
38  * G4INCLRandom.hh
39  *
40  * \date 7 June 2009
41  * \author Pekka Kaitaniemi
42  */
43 
44 #ifndef G4INCLRANDOM_HH_
45 #define G4INCLRANDOM_HH_
46 
47 #include <iostream>
48 #include <cmath>
49 #include <utility>
51 #include "G4INCLThreeVector.hh"
52 #include "G4INCLGlobals.hh"
53 #include "G4INCLLogger.hh"
54 
55 namespace G4INCL {
56 
57  namespace Random {
63  void setGenerator(G4INCL::IRandomGenerator *aGenerator);
64 
69  void setSeeds(const SeedVector &sv);
70 
76 
80  G4double shoot();
81 
85  G4double shoot0();
86 
90  G4double shoot1();
91 
95  template<typename T> T shootInteger(T n);
96 
100  G4double gauss(G4double sigma=1.);
101 
106 
112 
118  ThreeVector gaussVector(G4double sigma=1.);
119 
121  std::pair<G4double,G4double> correlatedGaussian(const G4double corrCoeff, const G4double x0=0., const G4double sigma=1.);
122 
124  std::pair<G4double,G4double> correlatedUniform(const G4double corrCoeff);
125 
129  void deleteGenerator();
130 
135 
136  }
137 
138 }
139 
140 #endif /* G4INCLRANDOM_HH_ */
ThreeVector gaussVector(G4double sigma=1.)
Generate Gaussianly-distributed ThreeVectors.
ThreeVector sphereVector(G4double rmax=1.)
Generate ThreeVectors that are uniformly distributed in a sphere of radius rmax.
void deleteGenerator()
Delete the generator.
T shootInteger(T n)
Return a random integer in the [0,n[ interval.
Definition: G4INCLRandom.cc:93
G4double shoot0()
Return a random number in the ]0,1] interval.
Definition: G4INCLRandom.cc:78
ThreeVector normVector(G4double norm=1.)
Generate isotropically-distributed ThreeVectors of given norm.
SeedVector getSeeds()
Get the seeds of the current generator.
Definition: G4INCLRandom.cc:70
G4double shoot1()
Return a random number in the [0,1[ interval.
Definition: G4INCLRandom.cc:85
std::pair< G4double, G4double > correlatedUniform(const G4double corrCoeff)
Generate pairs of correlated uniform random numbers.
bool G4bool
Definition: G4Types.hh:79
const G4int n
void setGenerator(G4INCL::IRandomGenerator *aGenerator)
Set the random number generator implementation to be used globally by INCL.
Definition: G4INCLRandom.cc:58
G4double gauss(G4double sigma=1.)
Generate random numbers using gaussian distribution.
Definition: G4INCLRandom.cc:97
G4double shoot()
Generate flat distribution of random numbers.
Definition: G4INCLRandom.cc:74
double G4double
Definition: G4Types.hh:76
std::pair< G4double, G4double > correlatedGaussian(const G4double corrCoeff, const G4double x0=0., const G4double sigma=1.)
Generate pairs of correlated Gaussian random numbers.
double Random(double min=0.0, double max=1.0)
Definition: UUtils.cc:69
G4bool isInitialized()
Check if the generator is initialized.
void setSeeds(const SeedVector &sv)
Set the seeds of the current generator.
Definition: G4INCLRandom.cc:66