We wanted to create a genetic drift graph for purposes of decoration. After briefly studying the concepts of genetic drift and a few online simulators I utilized what I knew about random numbers and built the following model.
An initial population is created. Each individual is given a variant, either 0 or 1, to represent a variant of a gene or an allele. The simulation starts; new individuals are born, old ones die and the population size fluctuates.
To obtain a process looking similar to the one of a genetic drift I gave each newborn a random number, in the range 0 to 1, to compare with the population average variant; the population containing individuals with variants 0 or 1, has an average variant between, or equal to, 0 and 1.
If the newborn's random number is lower than the average variant it is given the variant 1. If greater it is given the variant 0. Consequently, if the average reaches 1 (all individuals have a variant of 1 and the gene variant is fixed), all newborn's random numbers are lower and therefore all newborns are given a variant of 1. Likewise if the average reaches 0 (all individuals have a variant of 0 and the gene variant is lost), all newborn's random numbers are greater and all newborns are given a variant of 0.
This method does not represent the population and it's gene variants accurately. One would think if 80% of the population has a specific gene variant, in our case the average variant of 0.8, the probability of a newborn with this variant would be closer to 80%, not 20% as it is in the current model. However this model was able to provide us visually with what we were after.
Project .hip file download: https://goo.gl/a7eeEr