Meosis.
Unlike how other cells divide (mitosis), sex gametes have their genes jumbled up during cell division. It is not an exact copy like when a normal cell divides. This is why even if you 'self' a plant you can get different traits expressed in the next generation... it is not a clone even if it has sex with itself, bwahah, There is much less diversity, and that is a problem, but still not a clone of the parent (singular).
gametes are haploid cells - pollen or ovary in this case.
visual aid from Britannica
https://cdn.britannica.com/88/78588-050-8F99E222/formation-gametes-meiosis-process.jpg
one cell becomes 4 haploid cells by the end. It divides twice but the 2nd division does not replicate the chormosomes.
Mitosis -- https://cdn.britannica.com/87/78587-050-A85FBB5D/cell-rise-daughter-cells-mitosis-process.jpg
You can see the gentic recombination does not occur in mitosis - that's where it gets jumbled up in meosis and diverse pollen cells or diverse ovaries that are not identical to each other.