LCD displays random characters

I have tested your setup and codes one-to-one correspondence. It is working fine. I don't see any erratic characters on the LCD. Please, check any loose/intermittent connections with the LCD.

Thanks,