33 #define INCLXX_IN_GEANT4_MODE 1
60 INCL_ERROR(
"INCL random number generator already initialized." << std::endl);
80 while( (r=
shoot()) <= 0. )
87 while( (r=
shoot()) >= 1. )
94 return static_cast<T
>(
shoot1() *
n);
108 return sigma*std::sqrt(-2*std::log(u))*std::cos(v);
113 return sigma*std::sqrt(-2*std::log(u))*std::sin(v);
120 const G4double stheta = std::sqrt(1.-ctheta*ctheta);
123 norm * stheta * std::cos(phi),
124 norm * stheta * std::sin(phi),
140 G4double factor = 1.-corrCoeff*corrCoeff;
144 const G4double y = corrCoeff * x +
gauss(sigma*std::sqrt(factor)) + x0;
145 return std::make_pair(x, y);
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.
shared_ptr< HepRandom > theGenerator
T shootInteger(T n)
Return a random integer in the [0,n[ interval.
G4double shoot0()
Return a random number in the ]0,1] interval.
ThreeVector normVector(G4double norm=1.)
Generate isotropically-distributed ThreeVectors of given norm.
SeedVector getSeeds()
Get the seeds of the current generator.
G4double shoot1()
Return a random number in the [0,1[ interval.
std::pair< G4double, G4double > correlatedUniform(const G4double corrCoeff)
Generate pairs of correlated uniform random numbers.
const G4double oneOverSqrtThree
void setGenerator(G4INCL::IRandomGenerator *aGenerator)
Set the random number generator implementation to be used globally by INCL.
G4double gauss(G4double sigma=1.)
Generate random numbers using gaussian distribution.
G4double shoot()
Generate flat distribution of random numbers.
G4double pow13(G4double x)
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)
G4double gaussianCDF(const G4double x)
Cumulative distribution function for Gaussian.
G4bool isInitialized()
Check if the generator is initialized.
void setSeeds(const SeedVector &sv)
Set the seeds of the current generator.