I would say something like
var population;
var male;
var female;
var birth;
var death;
funtion random_city()
{
population = random(1000);//Max Population
male = random(population);//Get random number of males
female = population - male; //And the rest are females
birth = random(population / 2);//Just 2 people can make one child at once
death = random(population); //get random death
}
And the "not random" part you can do with adding the parameters or sub them like
male = random(population - parameter);