• 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.
  • Vote for the theme of Hive's HD Modeling Contest #7! Click here to vote! - Please only vote if you plan on participating❗️

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: 44
Status
Not open for further replies.
Top