wrote function to create population