[JASS] Does GetRandomInt accept zero?

Status
Not open for further replies.
I have no idea how randomization works with computers... the last question I had was why getting a random 'real' number didn't cause the game to crash... logically, I pictured real numbers to have infinite decimal places...

All of the randomization triggers in blizzard.j start with 1 and not 0, so I thought they had a reason for that O_o

you're getting a real number while using GetRandomInt??

if not,
reals can have infinite decimal places but why would they cause a crash, and if they would then I think the makers of warcraft won't even put the action GetRandomReal()...
 
Reals are 32 bit floating points I believe. Thus they only have a finite accuracy and so can not crash. Basically a floating point is an approximation of a number, meaning it actually is not exact.

0.1 for example could become 0.100025 so it is truncated for accuracy.

I seriously doubt WC3 uses IEEE complient floating points as speed is more important than precision thus accuracy probably is only a 32 bit float so 4294967296 different numbers capable of being represented. I could be wrong.

Larger numbers lose accuracy in the decimal places, thus how the spread is provided.
 
Status
Not open for further replies.
Back
Top