Add and test numToId for easy conversions.

* Refactor _randomIDInBucketRange to use numToId.