Oops! Got a little ahead on this one! To effectively guard against generating a number that has already been generateded, one really needs to use a while loop (See Lesson 15.). For example,

while((rnum==num1)||(rnum==num2)||(rnum==num3)){

regenerate the random number

}

keeps regenerating indefinitely as long as "rnum" matches any of
the previously generated numbers. One can use several "if"
statements, but you only get as many levels of protection as you have
"if" statements. For example

if((rnum==num1)||(rnum==num2)||(rnum==num3)){

regenerate the random number

}

if((rnum==num1)||(rnum==num2)||(rnum==num3)){

regenerate the random number

}

**.**

**.**

**.**

Also, an easy way to test your program is to generate numbers only in the range from 1 to 4 and see if you get four distinct numbers.