<p>The problem is closely related to <a href="https://en.wikipedia.org/wiki/Sphere_packing_in_a_sphere" rel="nofollow noreferrer">packing identical spheres into a unit sphere</a> (maybe the two problems are even equivalent): having a solution of a packing of <code>n</code> spheres with radius <code>r</code> into a unit sphere, all sphere centers are inside a sphere with radius <code>1-r</code> and have a distance of at least <code>2r</code>. So a solution for packing identical spheres into a unit sphere can easily be transformed to a solution to your problem.</p>

<p>Proven optimal solutions for packing identical spheres into a sphere only exist up to <code>n=12</code>. So I guess you will also have to live with near-optimal solutions, at least for <code>n&gt;12</code>. The currently best known algorithm in terms of optimality seems to be
<a href="https://arxiv.org/abs/1202.4149" rel="nofollow noreferrer">Serial Symmetrical Relocation Algorithm for the Equal Sphere Packing Problem</a>.</p>
Algorithm for placing points evenly inside sphere
<p>If I have a sphere with center (x,y,z) and radius r, do an algorithm exist for placing X number of points (x,y,z) inside the sphere in such as way that the minimal distance to each other point is maximized?</p>

<p>E.g. one points would simply be placed in the middle, two points would be placed on the opposite borders, three points would be placed in a "triangle" formation on the border and so on.</p>

<p>As have been pointed out, an equal distance to each other point cannot be found for every number of points. The requirement is therefore to maximize the minimal distance between the points.</p>

<p><strong>Update:</strong></p>

<p>The following code generates points inside a sphere with radius 1.0, but does not maximize the distance.</p>

<pre><code>function getPoint() {
    var d, x, y, z;
    do {
        x = Math.random() * 2.0 - 1.0;
        y = Math.random() * 2.0 - 1.0;
        z = Math.random() * 2.0 - 1.0;
        d = x*x + y*y + z*z;
    } while(d &gt; 1.0);
    return {x: x, y: y, z: z};
}
</code></pre>

<p>I think I need some kind of iteration afterwards. I have tried to apply a force model using the n-body problem as inspiration, and while fun to watch, it didn't really work that well.</p>