Skin hue

Morgion

Citizen
Aug 23, 2017
5
4
3
Czech
Hello
Bit operators is little hard for me, so i ask here:
This set random skin hue for humans
Utility.Random(1002, 57) | 0x8000;
and how can i get back int value from this, if i need number that corresponds with hues.mul (1002-1058)
thank you
 

Falkor

Squire
Apr 11, 2018
300
105
43
wpshard.com
Shard Name
Whispering Pines
The random function will return an int of 1002-1058 just as you need. It's my understanding that the" | 0x8000" would cap the int at 32,768 if it were to be a number larger than that. This clearly cannot happen with the range given in the Random function so that part of the code isn't really doing anything.
 

Morgion

Citizen
Aug 23, 2017
5
4
3
Czech
Thank you for reply
C#:
int a = 1002 | 0x8000;
Console.WriteLine("a is {0}", a); //33770
Console.WriteLine("a is {0}", a ^= 0x8000); //1002
I figured out that operator ^= return value back to value from random function. But stil dont know why is this system used.
Anyway thanks again