You can't avoid that some students from year 1 will be in the same group again in year 2. For example, the 45 students who were in group A in year 1 must be spread among three groups in year 2. The best you can achieve then is that each group in year 2 has 15 students from group A of year 1 and 15 from group B of year 1.Originally Posted byMarc

A reasonable mix can probably be achieved by randomly assigning each student to a new group in each year. For a better mix, consider using quasirandom numbers.