Warcraft 3 Random Number Generator

General discussion of Warcraft 3. Threads may may be posted here if they don't fit into the other sections.

Moderator: Cheaters

stealer
Member
Posts: 70
Joined: April 14th, 2008, 1:01 am

Warcraft 3 Random Number Generator

Post by stealer »

Does anybody know how WC3 determines random numbers?
I'm kinda looking for the formula.

Also if you use the test map in worldeditor you'll have a fixed random number (unless you disable it)
Apparently the 'fixed seed' is 712 for random numbers between 1-1000.
User avatar
UndeadxAssassin
Grammar King
Posts: 2116
Joined: June 22nd, 2008, 10:11 pm
Title: Worst human for 4eva
Location: Mostly USEast

Re: Warcraft 3 Random Number Generator

Post by UndeadxAssassin »

Are you talking about the function

GetRandomInt(x,y)? From what I can tell, it's random, but then, I've never really payed too much attention to it.

If you wanna test it, I have a map with a -roll function (and it's pretty fun, too!) that I can easily edit to roll between 1-1000 instead of 100.
(20:53:52) Bartimaeus: Thank you, Jen.
(20:53:56) Bartimaeus: Truly, you are wise.
(23:44:12) Bartimaeus: I was in pubic school until middle school...
Learn how to extract and read RAW Codes here!

Need help? Click here and ask your question!
stealer
Member
Posts: 70
Joined: April 14th, 2008, 1:01 am

Re: Warcraft 3 Random Number Generator

Post by stealer »

No, i don't mean a function (or atleast not your example).

I'm wondering how wc3 determines a random number.
Computers cannot give a random number, theres no physical way.
So to generate a random numbers a computer may take the milliseconds of the current time and preform several mathematical equations on it OR take the 7th decimial pt of the current CPU temperature and do some mathematical equations.

I am curious how WC3 comes up with its random numbers because i've seen similarities between games that have random stuff where the random things are similar when i play the games close in time.