I have a function that creates a uniform random point inside a sphere of a specific radius:
radius = 5
r = radius * ( numpy.random.random()**(1./3.) )
phi = numpy.random.uniform(0,2*numpy.pi)
costheta = numpy.random.uniform(-1,1)
theta = numpy.arccos(costheta)
x = numpy.sin(theta) * numpy.cos(phi)
y = numpy.sin(theta) * numpy.sin(phi)
z = numpy.cos(theta)
point = numpy.array([x, y, z]) * r`
However, I'm trying to figure out how to get the point that gets generated to be within a sphere that's around a specific point in space rather than where it's being generated at currently around 0,0,0. I'm not math savvy at all so I'm not sure how to do this. There are plenty of examples of how to generate a random point in a sphere of a specific radius (ie Generate a random point within a circle (uniformly), but I haven't seen any in python that state how to do so inside a radius that's around a user specified point (or perhaps I'm just misunderstanding the math that gets used...).
There was one question that got asked/answered here (generate a random cluster of points around a given point python) but this didn't really help, there were some other somewhat similar questions but they were in either Java or C# (ie Randomly generate clustered points given a center coordinate in 3D).
I put in a simple drawing of what I have right now (on the left) and what I'm trying to do (on the right).differentOrigin
Any help or examples would be greatly appreciated!!