Generate a password randomly (optimized).