To make a dice roll uniform, wouldn’t it be easier to do randomNumber % 8 and only use it if it is from 0 to 5, and discard and re-roll otherwise?
(Since we can reasonably assume that randomNumber is a binary number, and thus would be balanced over 8 values instead of 6.)