Announcement

Collapse
No announcement yet.

The dangerous sea...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #46
    Originally posted by vondrack


    Soren, am I right? Or is it - even if only theoretically - possible to "just have a look" at the next RNG number, without actually "using it up"?
    Well I am not Soren but the answer is YES.

    All you have to do is keep track of the SEED you started with and the number of times you called the RNG. If you use the same seed and generate the same number of PSUEDO-random numbers you will always get the same result. Its just an algorithym and it does the exact same thing every time you give it the same seed. ALL computer generated random numbers are psuedo random rather than really random.

    This is the same basic principle in data encryption. A complex algorythim is used to convert data into a psuedo random sequence. As long as you have the encryption key (SEED NUMBER) and the algorythim you can put all back together again exactly as it was originally.

    Comment


    • #47
      Originally posted by WarpStorm
      Here is the guts of the standard PRNG (I don't know if Firaxis uses it or one of the many others available)

      return(((holdrand = holdrand * 214013L + 2531011L) >> 16) & 0x7fff);

      holdrand is the previous "random" number.
      This is how the seed is calculated in Civ3 (Civ III uses a linear congruential RNG):

      Code:
      seed = (seed * 1103515245) + 12345

      Comment


      • #48
        Hurricane, how did you find that Civ3 uses that function? The code I posted came from Microsoft's rand() function in the C Run Time Library. As you can see, it is also a basic linear congruential RNG with a 32 bit seed with a 15 bit positive output.
        Seemingly Benign
        Download Watercolor Terrain - New Conquests Watercolor Terrain

        Comment


        • #49
          Originally posted by Hurricane

          Galley sinking is determined JUST BEFORE your movement phase. This is easy to determine by seeing your galley sink, reload at the end of your previous turn, use up a random number and note that it didn't sink this time. It is also widely known that NO random numbers are used for ANY kind of movement. Including moving sea units into dangerous squares.
          Thanks. I figured that was the answer, but I wasn't able to test it myself.

          Comment


          • #50
            Originally posted by WarpStorm
            Hurricane, how did you find that Civ3 uses that function? The code I posted came from Microsoft's rand() function in the C Run Time Library. As you can see, it is also a basic linear congruential RNG with a 32 bit seed with a 15 bit positive output.
            That code was discovered by hwinkels on the other forum. You can read it here: http://forums.civfanatics.com/showth...=&pagenumber=2

            Comment

            Working...
            X