Genetic drift simulator (Wright-Fisher)
Simulated genetic drift: ten Wright-Fisher populations with a reproducible seed, heterozygosity H₀(1 − 1/2N)^g, fixed, lost or drifting tally.
The beam
10 populations, one single lawThe draw is fixed: rewinding or replaying shows the same realisation.
the ten histories and their envelopetheir meanE[p] = p₀, the expectationexpected H, the law
- Expected heterozygosity
- H(g) = H₀ (1 − 1/2N)^g = 0.111 at g = 150
- Fixation probability of allele A
- P(fixation) = p₀ = 0.5 (stopped martingale)
- Envelope
- at g = 150, the ten span 0 to 1
Note
The expectation E[p] = p₀ (dashed line) stays constant while the ten trajectories spread out.
Result
continuous computation- Displayed generationg
- 150
- Fixed populations (p = 1)p = 1
- 4
- Populations where A is lost (p = 0)p = 0
- 2
- Populations still drifting0 < p < 1
- 4
- Expected heterozygosityH
- 0.111
- Fixation probability of allele Ap0
- 0.5
- Random seeds
- 20260823
Calculation, assumptions and sources
Provisional · Physical model · reviewed on 24 August 2026
OverviewTen neutral Wright-Fisher populations of size N start from the same allele frequency p₀.
Ten neutral Wright-Fisher populations of size N start from the same allele frequency p₀. The ten trajectories of a seeded draw are plotted with the observed heterozygosity, compared with H₀(1 − 1/2N)^g, and the number of populations fixed, lost or still drifting at each generation.
Method & formulasp(g+1) = X / 2N, X drawn from B(2N, p(g))
The binomial moments give E[p] = p₀ and an expected heterozygosity multiplied by (1 − 1/2N) each generation. The fixation probability of A is p₀ (bounded martingale, optional stopping).
- Genetic drift
- the fluctuation of allele frequencies due to gamete sampling chance alone. Its intensity grows as N shrinks.
- Wright-Fisher model
- non-overlapping generations, constant size N, panmixia.
- Heterozygosity
- H = 2pq, the probability that two alleles drawn at random differ.
- Fixation and loss
- p = 1 (only allele A is left) or p = 0 (A has disappeared), the two absorbing states of the model.
- Seed
- the integer that sets the pseudo-random sequence of the draw. The same seed gives the same ten trajectories on any machine.
AssumptionsNeutrality: neither allele is favoured (no selection, no mutation, no migration).
- Neutrality: neither allele is favoured (no selection, no mutation, no migration).
- Non-overlapping generations and constant size N.
- Panmixia: the 2N alleles are drawn at random, with replacement, from the previous generation.
Validity domain3 validity limits; the calculation refuses values outside 3 of them
The model has two alleles. Even weak selection dominates drift once Ns exceeds unity; mutation reopens the absorbing states. Ten trajectories give an order of magnitude and support no inference on real data.
0 ≤ p0 ≤ 1physical · refusal
An allele frequency lies between 0 and 1.
Instead · For a percentage, divide by 100.
2 ≤ n ≤ 2000model · refusal
From 2 to 2000 individuals. Above that, drift is nearly still and the full draw would take too long to recompute on every keystroke.
Instead · Compare N = 50 and N = 1000 at equal seed.
1 ≤ g ≤ 300practical · refusal
The number of simulated generations is bounded between 1 and 300.
Instead · At N ≤ 2000, 300 generations are enough to see the H(g) law and the first fixations.
Simulated trajectories and expected lawAt N = 50, populations fix or lose the allele within a few dozen generations; at N = 1000, with the same seed, the trajectories barely drift.
At N = 50, populations fix or lose the allele within a few dozen generations; at N = 1000, with the same seed, the trajectories barely drift. The "large population" of the Hardy-Weinberg conditions is one where drift is negligible on the timescale considered.
Scientific validationProvisional, reviewed on 24 August 2026
No bibliographic reference is cited until the usual source for the model has been checked against a primary edition. A convergence test compares the law H(g) = H₀ (1 − 1/2N)^g with the observed heterozygosity averaged over thousands of trajectories, within a tolerance set by the standard error.
Scope and limitations
- The draw uses the mulberry32 pseudo-random generator (32-bit state), whose envelope has been measured up to a few million draws per simulation. It is neither cryptographic nor designed for precision Monte-Carlo.
Provisional · Sources and assumptions are provided; the documentary review is incomplete.
Physical model. Conventional display to 3 decimal places.
Revision log
Tool created: seeded neutral Wright-Fisher simulation (ten trajectories), observed heterozygosity against H₀(1 − 1/2N)^g, fixation probability, fixed/lost/drifting tally.
First published result of the tool, with no previous value to compare against.