=.;
dot =.;
dot[r_] := Module[{rand,rz,u,rxy},
rand = 2 r*Random[] - r;
rz = rand;
rand = 2 Pi*Random[];
u = rand;
rxy = Sqrt[r^2 - rz^2];
{rxy*Cos[u],rxy*Sin[u],rz}
]
Graphics3D[Point[Table[dot[1],{r,1,5000}]],Boxed -> False]
(*复制即可 *)
=.;
dot =.;
dot[r_] := Module[{rand,rz,u,rxy},
rand = 2 r*Random[] - r;
rz = rand;
rand = 2 Pi*Random[];
u = rand;
rxy = Sqrt[r^2 - rz^2];
{rxy*Cos[u],rxy*Sin[u],rz}
]
Graphics3D[Point[Table[dot[1],{r,1,5000}]],Boxed -> False]
(*复制即可 *)