update function generateRandomChar

update function generateRandomChar