I just spent all morning fixing a problem that hadn't happened yet. I'm working on adding enemy armies to the world map, and I knew that my random placer wasn't going to work as intended... I give the random placer some info that includes type of army, type of terrain, likelihood of spawning, and maximum number of armies to spawn. It was going to be really slow iterating through each terrain hex, seeing if it matched the terrain type, and if so then rolling the dice to see if the enemy army spawned, and doing that until you either ran out of terrain hexes or reached the maximum number of spawns. And if you had a high likelihood of spawn and low maximum number to spawn, then the armies would always appear in the same location.
So I just spent the last few hours changing the randomizer to work like this: Categorize all the hexes by terrain type, then select a percentage of those to have an enemy army appear on it, then pick that many terrain hexes at random from that pile (removing them from the eligible list as you go), and then put enemy armies on them.
Now my randomizer is working much better. But I still haven't actually put any enemy armies on the map. :specs: