Need to make my program send random OTPs to my phone number

You have to break it down into two parts - generating a random character, and generating a string of characters. A random character is just a random byte sized integer in the ASCII range that you want to restrict it to. This is too easy to give you code for.