• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

Warcraft3 random implementation

Status
Not open for further replies.
Level 18
Joined
Jan 1, 2018
Messages
728
I'd like to know how random numbers are implemented in Warcraft 3.
Tried searching and found a python script, however when running it I get a different result using the same seed (10) and low/highbound (0~100) (result was 43 in python (3.9.0), 55 in wc3 (1.31)).

I also found the decompiled code, but it's missing the SetRandomSeed and table, so can't use that either.

Does anyone know where to find a working implementation?
 
Level 14
Joined
Sep 28, 2011
Messages
968
Did you try comparing with the results of the random number generating library of C++?(and with the one of C?)
I have no clue if the random generator in C++ have similar results to the one of python and it is assumed WC3 was made in C++
 
Level 18
Joined
Jan 1, 2018
Messages
728
Did you try comparing with the results of the random number generating library of C++?(and with the one of C?)
I have no clue if the random generator in C++ have similar results to the one of python and it is assumed WC3 was made in C++
Wc3 has its own random number generation algorithm (like you say in C++), so I didn't compare it with the 'standard' C/C++ algorithm, since they are not the same and so I can say with 99.9% certainty they will return different results.

The python script in the linked thread supposedly implements Wc3's algorithm, but like I said I get different results, so not really sure. Though that post is also over 2 years old, when 1.29.2 was latest, and 1.30 was in PTR, while I tested this in 1.31 PTR. Maybe the implementation was changed at some point?
 
Status
Not open for further replies.
Top