Period question

What causes a period to go from perfectly normal to irregular? Is it genetic?