How to setup password generator

Hello, the principle is simple, i want a user to enter a password that I give to him and acces to 2 more passwords to give to someone elses. Next users with a password can generate 2 more password to give to someone elses and it goes on and on.

Thanks for your help !