           cth=2.*(ran2(idum)-.5)
           sth=SQRT(1.-cth*cth)
           signs=2.*(ran2(idum)-.5)
           sth=signs*sth/ABS(signs)
           phi=twopi*ran2(idum)
           cthv=2.*(ran2(idum)-.5)
           sthv=SQRT(1.-cthv*cthv)
           signs=2.*(ran2(idum)-.5)
           sthv=signs*sthv/ABS(signs)
           phiv=twopi*ran2(idum)
           x=r*sth*COS(phi)
           y=r*sth*SIN(phi)
           z=r*cth
           vx=v*sthv*COS(phiv)
           vy=v*sthv*SIN(phiv)
           vz=v*cthv
