Own password generator (on import)

Hello!
Is it possible to implement an own password generator for use during the import of students?
I tried it as an userhook (pre_create), but it does not work.
Any ideas?

Mastodon