dear student, yes your view poin is correct to an extent that random function generates random numbers every time executes. As for as your code is concerned it is not complete although logic is correct. Try to compile it in the compiler and if you face any issues then let it know.