try using randomize() - 'Seeds' the random() sequence with a new random number.

and then random() - Returns a random number.

I dont think that you can set a numeric range, so to get an integer
between 10 and 170 here's what I'd do...

//newPanValue is set to a number beween 0 and 160
newPanValue = int(random(161));

//incrementing it by 10 will get you in your 10 to 170 range
newPanValue += 10;

Now you can set the pan of the entity to this value.