I want to send a PWM output to a pin that is chosen at random. How do I specify the PIN in the PWM syntax using a variable generated by RANDOM?

I.E. I would normaly send:

PWM PORTD.0, 155,50

Want to send:

PWM "random pin",155,50

Where "random pin" would be a variable generated by a previous RANDOM command being a number between 0 and 7 corresponding to the pin number on port D. I know how to generate the random number I need to know how to use a variable for the pin in the PWM command.