• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Random number in W3

Status
Not open for further replies.
Level 6
Joined
Dec 8, 2016
Messages
127
I am planning to make a gambling map, are the random numbers in this game functions well like how you expect the 100% randomness of dice roll or lottery ticket?

If not, how can i trigger a 100% random number?
 
I have reversed GetRandomInt partially here

Here is an implementation of GetRandomInt & SetRandomSeed in python as well.

As for the how cinematics affect the seed:

JASS:
if (cineMode) then
    // Save the UI state so that we can restore it later.
    if (not bj_cineModeAlreadyIn) then
        set bj_cineModeAlreadyIn = true
        set bj_cineModeSavedSeed = GetRandomInt(0, 1000000)
    endif

    // Use a fixed random seed, so that cinematics play consistently.
    call SetRandomSeed(0)
else
    set bj_cineModeAlreadyIn = false

    // Perform global changes
    call SetRandomSeed(bj_cineModeSavedSeed)
endif
 

Attachments

  • rand.zip
    931 bytes · Views: 49
Status
Not open for further replies.
Top