Function RMGGeneratorUtil::rand(const G4Sphere *, bool)

Function Documentation

G4ThreeVector RMGGeneratorUtil::rand(const G4Sphere*, bool on_surface = false)

Generate a random point in or on the surface of a G4Sphere.

Uses spherical coordinate sampling to generate a point either inside the sphere or exactly on its surface.

Parameters:
  • sphere – Pointer to the G4Sphere.

  • on_surface – If true, sample on the sphere’s surface; otherwise, inside it.

Returns:

A random point as G4ThreeVector.