That line of code will scale the WORD sized Randvar variable (0 to 65535) to a value ranging from 1 to 7.

Bascially it's the same as doing Result = Randvar * 7 / 65536 + 1

/Henrik.