rand_table: use u16 and remove some panic points
This changes some numeric types and operations to make RandState operations safer. In particular:
- RAND_TABLE values are all u16
- index and counter are u16
- u16->usize does not require any unsafe cast
- saturating add/sub operations are still correct, and safer