title: Sampling uniformly distributed random points inside a spherical volume using numpy arrays (PLOTLY)
body: <p>I want to distribute 5k points in a homogeneous sphere of radius 100. I used the cumulative mass distribution <a href="https://stackoverflow.com/questions/28434765/how-to-randomly-distribute-n-masses-such-that-they-follow-a-plummer-density-dis">(integral here)</a> to calculate the radius point value. But when I plotted the sphere, it has cumulative points in the vertical axis:
  <a href="https://i.stack.imgur.com/ziTcO.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>Here is my code:</p>
  <pre><code>import plotly.express as px
  from numpy import  sin, cos, pi, random, array
  
  phi = random.uniform(0, 2 * pi,5000)
  theta = random.uniform(0,pi,5000)
  u = random.uniform(0, 1,5000)
  
  r = array([0]*5000)
  x = array([0]*5000)
  y = array([0]*5000)
  z = array([0]*5000)
  
  for i in range(0,5000):
       r[i] = ( 100 * (u[i]) ** (1 / 3))
  
       x[i] = ( r[i] * sin(theta[i]) * cos(phi[i]))
       y[i] = ( r[i] * sin(theta[i]) * sin(phi[i]))
       z[i] = (r[i] * cos(theta[i]))
  
  
  df = px.data.iris()
  
  fig = px.scatter_3d(df, x = x, y = y, z=z, title='Distribuição de pontos em um esfera')
  fig.update_traces(marker=dict(size=1))
  fig.update_layout(template = 'plotly_dark',scene=dict(xaxis_title=&quot;Abscissa&quot;, yaxis_title=&quot;Ordenada&quot;, zaxis_title=&quot;Cota&quot;))
  fig.show()
  </code></pre>