• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[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