Struggling with switching Arduino and Random numbers

while(signal=HIGH)

You will never get out a loop like that, unless you break it in the loop.

Likely you are looking for something like this:

  while (read_mysignal() == HIGH) ...

The same with your multiple if statements.