How does this generator avoid clashes?
Many free online timetable makers hand you a blank grid and leave the placing to you. This one does the placing: no period ever holds two lessons for the class, and the same subject rarely repeats on one day unless you allow double lessons. It works from a randomized pass ordered by your preferences, then repairs the layout until every lesson fits or the grid is full.
Because it works from a seed, the same inputs always produce the same timetable. Regenerate changes the seed, so you get a different valid arrangement each time without editing anything.