How to set up phase space of the proton beam?

Good evening!
I am new to Geant4 and i am trying to build a simple proton pencil beam model.A parameterization of the source model at the source plane is therefore required, including the spatial beam,spread distribution (beam spot size), σx, and the angular spread distribution (beam divergence), σxθ, as well as the coefficient of correlation ρx (the same relation holds for the y‐direction).The 2D Gaussian probability density function of x and θ is(i know the values of σx、σxθ and ρx):


But i don’t know how to generate random numbers according to the 2D probability density function in geant4. Does anyone know?
Thank you very much!!!!

Closing as a duplicate of How to generate random numbers according to the 2D probability density function