• Portal
  • Forums
  • Shop
  • Statistics
    • Players
      Games
      Maps
      Top
      Levels
      Countries
  • GameServer
  • Downloads
  • Discord
  • Logs
    • Chat
      Warns
      Bans
  • Search
  • Extras
    • Forum Members
      Team Members
      Stats For Nerds
      Recover Account
      Calendar
      Help
      Forum stats
      View New Posts
      View Today's Posts
Reign of the Undead - Revolution
Login to account Create an account
Login
Username:
Password: Lost Password?
 

Dear Guest!
Please sign up or login to use all features of the website.

  Reign of the Undead - Revolution Reign of the Undead Bugs
« Previous 1 ... 3 4 5 6 7 8 Next »
Pink ORB - MIxed

Thread Modes
Pink ORB - MIxed
Soldier . . . Offline
I am not a moderator
***
VIP
Donator
Insider
Posts: 222
Threads: 10
Joined: Jul 2012
Thanks given: 0
Thanks received: 90
#7
08-24-2016, 09:02 PM (This post was last modified: 08-24-2016, 09:02 PM by Soldier . . ..)
I have completely lost the faith in the randomness of the random generator of CoD a long time a go already.

Here a better algorithm to generate a random value.
You can try to implement this one and use it instead of the one of CoD.
If you have time and like to do it of course Wink

Code:
static unsigned int m_z = 12434;
static unsigned int m_w = 33254;


// random generator -----------------------------------------------
unsigned int random (unsigned int iSize)
{
    static unsigned int iRandOld = 0;
    
    m_z = 36969 * (m_z & 65535) + (m_z >> 16);
    m_w = 18000 * (m_w & 65535) + (m_w >> 16);
    
    if (iRandOld == (((m_z << 16) + m_w) % iSize))
    {
        m_z = 36969 * (m_z & 65535) + (m_z >> 16);
        m_w = 18000 * (m_w & 65535) + (m_w >> 16);
    }
    
    iRandOld = ((m_z << 16) + m_w) % iSize;
    
    return (iRandOld);
}

examples:
Quote:number of random generator function calls checked: 2000000
number of unique values that can be created: 4

first 2 numbers match to start: 156345
first 3 numbers match to start: 48804
first 4 numbers match to start: 15167
first 5 numbers match to start:  4740

first 2 numbers are equal: 124969,   6.25%
first 3 numbers are equal:   7858,   0.39%
first and third are equal: 593289,  29.66%

  0 = 499519,  24.98%
  1 = 500641,  25.03%
  2 = 499703,  24.99%
  3 = 500137,  25.01%
Quote:number of random generator function calls checked: 2000000
number of unique values that can be created: 5

first 2 numbers match to start: 96245
first 3 numbers match to start: 23215
first 4 numbers match to start:  5652
first 5 numbers match to start:  1361

first 2 numbers are equal:  79299,   3.96%
first 3 numbers are equal:   3070,   0.15%
first and third are equal: 464242,  23.21%

  0 = 399637,  19.98%
  1 = 400140,  20.01%
  2 = 400008,  20.00%
  3 = 400391,  20.02%
  4 = 399824,  19.99%
Quote:number of random generator function calls checked: 4000000
number of unique values that can be created: 7

first 2 numbers match to start: 93256
first 3 numbers match to start: 15404
first 4 numbers match to start:  2533
first 5 numbers match to start:   414

first 2 numbers are equal:  81555,   2.04%
first 3 numbers are equal:   1741,   0.04%
first and third are equal: 641392,  16.03%

  0 = 571390,  14.28%
  1 = 571488,  14.29%
  2 = 571107,  14.28%
  3 = 572189,  14.30%
  4 = 571982,  14.30%
  5 = 570435,  14.26%
  6 = 571409,  14.29%
Quote:number of random generator function calls checked: 4000000
number of unique values that can be created: 21

first 2 numbers match to start:  9555
first 3 numbers match to start:   492
first 4 numbers match to start:    32
first 5 numbers match to start:     3

first 2 numbers are equal:   9047,   0.23%
first 3 numbers are equal:     17,   0.00%
first and third are equal: 198405,   4.96%

  0 = 190227,   4.76%
  1 = 190142,   4.75%
  2 = 190308,   4.76%
  3 = 191151,   4.78%
  4 = 190740,   4.77%
  5 = 189281,   4.73%
  6 = 190797,   4.77%
  7 = 190227,   4.76%
  8 = 190962,   4.77%
  9 = 190001,   4.75%
 10 = 190175,   4.75%
 11 = 190247,   4.76%
 12 = 190459,   4.76%
 13 = 190224,   4.76%
 14 = 191017,   4.78%
 15 = 190687,   4.77%
 16 = 190621,   4.77%
 17 = 190686,   4.77%
 18 = 191104,   4.78%
 19 = 190438,   4.76%
 20 = 190506,   4.76%
Find
Reply
Thanks given by: fashion , Forau , fabio , West
Share Thread:    


Messages In This Thread
Pink ORB - MIxed - Forau - 08-23-2016, 07:59 PM
RE: Pink ORB - MIxed - Soldier . . . - 08-23-2016, 10:41 PM
RE: Pink ORB - MIxed - fashion - 08-23-2016, 11:35 PM
RE: Pink ORB - MIxed - fabio - 08-24-2016, 11:11 AM
RE: Pink ORB - MIxed - West - 08-24-2016, 03:38 PM
RE: Pink ORB - MIxed - Forau - 08-24-2016, 05:57 PM
RE: Pink ORB - MIxed - Soldier . . . - 08-24-2016, 09:02 PM
RE: Pink ORB - MIxed - fabio - 08-26-2016, 08:37 AM
RE: Pink ORB - MIxed - Soldier . . . - 08-26-2016, 03:20 PM
RE: Pink ORB - MIxed - fabio - 08-26-2016, 09:17 PM

  • View a Printable Version
  • Subscribe to this thread


Users browsing this thread:
1 Guest(s)

  • Contact Us
  • Forum team
  • Forum stats
  • Return to Top
 
  • RSS Syndication
  • Lite mode
  • Home
  • Help
 
© Copyright 2025 by MODS-Clan
www.modszombies.com



Linear Mode
Threaded Mode