There are four soldier looks: Blonde, Brown-hair, Asian and African.
They are randomly chosen, although I believe someone recently tied them to the nationality.
Yeah, that was me, with some help from Warboy. I got a bit tired of the namefiles throwing out completely random looks, so we'd have european-looking soldiers wandering around with Chinese names, a 25% chance that russians would be black when in reality they're a sub-1% minority, and so on.
I actually went reasonably in-depth to do this, too.
Each default namefile now has four values listed under lookWeights (in the order of the integer determining which look is which, so Blonde European, Brown European, Asian, and African looks) to weight how likely each given soldier is to be a certain look. For countries that don't fit neatly into any of the four looks, I approximated data based on skintone. (so some places that have paler brown skin will use the asian look despite looking very different to the paperdoll, and other places with darker brown skin will use the african look, despite also having differences there) I've used real demographic information where available. This should decrease the incidence of, for instance, Russians of african descent, down to more realistic probabilities, so soldiers with odd ethnicity-name mixes can still show up where we allow for them.
It also has some smart handling where if you fail to give the right number of values it defaults any omitted values to 2 and ignores any extra values. (this should make the code play nice with mods when we plug in the ability to add more looks, we just need to unhardcode the number 4 for that)
Because there's no weighting of which namefile to choose, however, it did have the side-effect that suddenly you had a BUNCH more white soldiers, seeing we have a ton of european namefiles. Hence why I also added a few more african namefiles and a korean one just after I did that PR.
If I wanted to be really clever I'd add some code that would attach namefiles to a funding country, and then would weight the namefiles based on their proximity to the base you're hiring at, but that would be a lot more work, the system is probably sufficiently organic as it is.