The perpetrator in a school shooting usually acts based on some sort of grudge, but in this case none is obviously apparent.
If police have not found any note or communication yet, they have to speculate about the motive. I suspect the core theme is his targeting of girls. He might have been spurned by a girl and wanted to get his own back. Most of these attackers are pupils who go (back) to their own schools in order to perpetrate these tragedies. It’s a common denominator from Columbine onwards. Schools are easy targets and it’s the ultimate attack on innocent victims.