Think of the difference between 1 dice and 3 dice. 1 Dice gives you an even probability for all values, while 3 dice will tend to have a higher probability for the values towards the middle.
The more "dice" in your equation, the stronger your chance to get something towards the centre. So let's define a function that can handle any number evenly:
// Takes a random number between floor and ceil
// pow defines how strongly these results should gravitate towards the middle
// We also define a function TrueRand(floor, ceil) elsewhere where you should substitute your own random function
int CenterRandom(int floor, int ceil, int pow = 3)
if(ceil == floor)
return ceil; // don't care to compare
int total = 0;
for(int x = 0; x < pow; x++)
total += TrueRand(floor, ceil);
return total / pow;
Now we can define an example function to use this:
// Distribues a number of points between floor and ceil
// We assume a function PlotPoint(int) exists to aid in creating the planet, etc...
void DistributePoints(int floor, int ceil, int numPoints)
// Could easily output this in the function parameters, but language wasn't specified
int numBreaks = 0;
// Special case for first pair
breaks = CenterRandom(floor, ceil);
for(int x = 0; x < numPoints - 1; x++)
// Generate a random number linearly, this will be used for picking
// This way we have a greater chance of choosing a random value between larger pairs
int picker = TrueRandom(floor, ceil);
// Now we first find the pair of points that our picker exists on
// For simplicity, we handle the first and last pair separately
if(picker >= floor && picker < breaks)
breaks[x] = CenterRandom(floor, breaks - 1);
for(int i = 0; i < numBreaks; i++)
if(picker > breaks[i] && picker < breaks[i+1])
breaks[x] = CenterRandom(breaks[i] + 1, breaks[i+1] - 1);
if(picker > breaks[numBreaks] && picker <= ceil)
breaks[x] = CenterRandom(breaks[numBreaks] + 1, ceil);
PlotPoint(breaks[x]); // Plot the point
Now the first to note is that this code really doesn't check if picker matches one of the points already. If it does then it's just not going to generate a point, possibly something you'd might like.
To explain what's going on here is that CenterRandom generates a bell curve of sorts. This function breaks up the plane into multiple bell curves, one per pair of points existing. The picker tells us which bell curve to generate from. Since we pick linearly, we can ensure that pairs with larger gaps between them will be chosen more often, but we still leave it completely random.
Hope this points you in the right direction.