So, basically, I have implemented a naive rarity system, where I have randomly generated byte values(0-255). From them I determine an enum variable as such:
case < 100:
return 0;
case > 100 and < 180:
return 1;
case >180 and <235:
return 2;
case > 235:
return 3;
So now I'm at the point, where I would like to improve some of my code and this method keeps bothering me. As you can see, values, corresponding to different enum numbers, are unequal. And I started wondering, is there a way to represent this kind of a cast with a formula? I fidgeted a bit with it, but I'm really no mathematician) So I'd appreciate some help