Import Geant4 10.2.0 source tree
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RandomTools.hh 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
// $Id: G4RandomTools.hh 90092 2015-05-13 11:53:25Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -56,9 +56,12 @@ inline G4ThreeVector G4LambertianRand(const G4ThreeVector& normal)
|
||||
{
|
||||
G4ThreeVector vect;
|
||||
G4double ndotv;
|
||||
G4int count=0;
|
||||
const G4int max_trials = 1024;
|
||||
|
||||
do
|
||||
{
|
||||
++count;
|
||||
vect = G4RandomDirection();
|
||||
ndotv = normal * vect;
|
||||
|
||||
@@ -68,7 +71,7 @@ inline G4ThreeVector G4LambertianRand(const G4ThreeVector& normal)
|
||||
ndotv = -ndotv;
|
||||
}
|
||||
|
||||
} while (!(G4UniformRand() < ndotv));
|
||||
} while (!(G4UniformRand() < ndotv) && (count < max_trials));
|
||||
|
||||
return vect;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user