syntax error, unexpected ‘while’ (t_while) please help :)

You’re missing a ; on this line:

$count         = strlen( $charset )

Should be:

$count         = strlen( $charset );