The function is used by two events and one planetary improvement to spawn a planet near the race triggering it. It has two parameters, one for the population on the planet and one for the class of the planet. The function does not use the population parameter correctly. If the parameter is zero, the population is zero. If the parameter is any non-zero number, positive or negative, the population is always 5.
This is why the Mysterious Outpost event spawns a Class 1 planet with 5 population. The actual code for spawning the event is this:
<Action>SpawnPlanetNearUs</Action>
<ValueParam>1</ValueParam>
<ValueParam>1</ValueParam>
This shows the intent was to spawn a class 1 planet with 1 population. I've experimented with the values and found that the first one is for population, and the second is for planet class. Due to the bug, the actual population is 5. The population dies off at 0.1 per turn until the population reaches the planet class of 1. This extra population can be useful for filling colony ships to colonize other planets or to transfer population to other planets if the ships can be built fast enough, but some will nearly always die off. This die-off does not apply to Synthetic races.
This function is also used in the Abandoned Device event and when Brindle's Observatory is built.
Here is the code for the Abandoned Device event:
<Action>SpawnPlanetNearUs</Action>
<ValueParam>5</ValueParam>
<ValueParam>8</ValueParam>
The parameter for population is actually 5, so it gives the desired amount. However, the maximum population allowed is 3 on a class 8 non-home planet unless something has happened to increase the population cap. The population will die off at 0.1 per turn until it reaches 3. Again, this die-off does not apply to Synthetic races.
These two events are in StartingEventDefs.xml in the base game.
Here is the code for Brindle's Observatory:
<Action>SpawnPlanetNearUs</Action>
<ValueParam>15</ValueParam>
<ValueParam>9</ValueParam>
This has a population value more than the planet class, so I'm not sure what the intent is here. Whatever it is, the actual population is 5 due to the bug. Since it is a non-home planet, the population will die off like in the two events mentioned earlier, except for Synthetic races.
Brindle's Observatory is in ImprovementDefs.xml in the Crusade and Retribution expansions.
If the bug can be fixed, the Mysterious Outpost event will work correctly. The Abandoned Device event and Brindle's Observatory will still need to have their population values lowered to 3 to avoid the slow deaths of 2 population for non-Synthetic races.
There is another problem that becomes apparent when the Mysterious Outpost event occurs. Sometimes it spawns a class 1 planet with two tiles. This seems to be caused by the order used to generate the planet features. I don't think it has anything to do with this function, but is a problem with the planet generating function that only appears with a class 1 planet. I have made separate post about it.