Code problem question: Branches alternative

Hello,
I have some question I didnt find a clear answer to, so Im asking to you that surely are way more expert than me.

Lemme give some context:

Im trying to solve a problem that is about an alternative to using a couple of Branch nodes.

-I have an actor, this actor has a random Integer assigned between a min-max value that the code will assign to it and display to the player through a WidgetB. Nothing hard, very easy.
But this number is random, as I said, so in order to assign it the right Enum (I need this Enum value in order to display it correctly in grams/1 digit Kg/2digits Kg etc etc…) value I need to do basic math with branches before setting the right Enum.

-The workflow basically is: Random Int between Min-Max → Result Int >= than x, /> than or < than? Branches check → if one of this branches is true then the Enum is setted to the right value.

Example: Random Int assigned is 13000, 13000 is greater than 10000 so assign the Enum = Chilograms.

-This “random Int” is one and only one, is not setted to multiple actors but to one single actor and every time is cleared before setting it again.

Now, my question is, is there a way to zip the code and make it more “elegant” without using 3-4 branches nodes and then assign/set the right enum?

I tried using a Map Var. but the problem, as you can imagine, is the map doesnt know if the Integer belongs to Enum 1 or Enum 2 or Enum 3 because the Int is random generated, so I need anyway to use branches to check that integer before setting the right enum, so making it useless using a map and a for each loop to make a more slim code.

Is there any workaround to this problem or, considering is a random number, the only way is using basic math –> branches –> set Enum?

Thanks for the time reading this no-sense

it was quite hard to understand, but i don’t think having multiple branches is bad. it’s one of the few cases where it might be the best way.

a branchless code would use math to convert those ranges to “discrete” values https://statisticsbyjim.com/basics/discrete-vs-continuous-data/

that match the enum values, then convert the values to enum directly.

but that math could be tricky.

if you end up using something like clamp or mod (%) it will use a branch under the hood.
and it will make it much much harder to read and tell the intention.

don’t understimate the value of clarity of intention and ease of understanding.

aesthetics by themselves are not valuable and are subjective. ease of read, maintain, and clarity of intention are much more important, in my experience (they are still subjective, but asthetics are extremely contentious for no good value). unfortunately it’s very easy to confuse ease of read with aesthetics.