When a 7 is rolled, are the cards discarded randomly?
No, the card holder chooses.

From the rules, page 11 (emphasis is mine):


  Each player counts his Resource Cards. Any player with more than 7 Resource Cards (i.e., 8 or more), must choose and discard half of them.