Skip to content

Commit

Permalink
PrimaryGeneratorAction. Minor improvements. Issue #9.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgalan committed May 11, 2021
1 parent 8e6c7ef commit 1cef229
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/PrimaryGeneratorAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -672,11 +672,11 @@ G4ThreeVector PrimaryGeneratorAction::GetIsotropicVector() {
G4double a, b, c;
G4double n;
do {
a = (G4UniformRand() - 0.5) / 0.5;
b = (G4UniformRand() - 0.5) / 0.5;
c = (G4UniformRand() - 0.5) / 0.5;
a = 2 * (G4UniformRand() - 0.5);
b = 2 * (G4UniformRand() - 0.5);
c = 2 * (G4UniformRand() - 0.5);
n = a * a + b * b + c * c;
} while (n > 1 || n == 0.0);
} while (n > 1 || n < 0.01);

n = std::sqrt(n);
a /= n;
Expand Down

0 comments on commit 1cef229

Please sign in to comment.