I remember once my high school teacher said when the sperm fertilizes the egg the genes are mixed very randomly, is that true?
No. When sperm and ova are forming, the chromosomes you inherited from your mother lines up with the chromosome you inherited from your father, and "crossing over" happens. It would be like taking a Merriam-Webster dictionary, and another brand of dictionary, and picking a random point (like say, the middles of the "C" section), cutting both books at that point, and joining the portion of one with the portion of the other, making new books that are part Merriam Webster, and part the other kind of dictionary. That happens in every chromosome, and the gamete is made up of those franken-chromosomes.