Modelling of the transmission of an infection through a randomly generated population