Using a code as login

If it is a login code, I would use this to generate a string, and I would assign it as a code [SOLVED] Assign random # to a thing