1. SPS Accounts:
    Do you find yourself coming back time after time? Do you appreciate the ongoing hard work to keep this community focused and successful in its mission? Please consider supporting us by upgrading to an SPS Account. Besides the warm and fuzzy feeling that comes from supporting a good cause, you'll also get a significant number of ever-expanding perks and benefits on the site and the forums. Click here to find out more.
    Dismiss Notice
Dismiss Notice
You are currently viewing Boards o' Magick as a guest, but you can register an account here. Registration is fast, easy and free. Once registered you will have access to search the forums, create and respond to threads, PM other members, upload screenshots and access many other features unavailable to guests.

BoM cultivates a friendly and welcoming atmosphere. We have been aiming for quality over quantity with our forums from their inception, and believe that this distinction is truly tangible and valued by our members. We'd love to have you join us today!

(If you have any problems with the registration process or your account login, please contact us. If you've forgotten your username or password, click here.)

Neverwinter Nights 2 Forum News (Apr. 03, 05)

Discussion in 'Game/SP News & Comments' started by chevalier, Apr 4, 2005.

  1. chevalier

    chevalier Knight of Everfull Chalice ★ SPS Account Holder Veteran

    Joined:
    Dec 14, 2002
    Messages:
    16,815
    Media:
    11
    Likes Received:
    58
    Gender:
    Male
    Here are today's Neverwinter Nights 2 forum highlights, collected by NWVault from Obsidian Forums. Please take into account that these are only single parts of various threads and should not be taken out of context. Bear in mind also that the posts presented here are copied as-is, and that any bad spelling and grammar does not get corrected on our end.

    Adam Brennecke, Programmer

    WHOA! I think WP leaked a screenshot!
    [​IMG] Not normal mapped. Try again...

    Jason Keeney, Programmer

    Random Number Generator
    For most things (and most games) the standard C rand() is perfectly fine. I dont think its nearly as bad as you seem to be making it out to be... especially for something with such "lightweight" statistical requirements as a D&D dice sim.

    I'm a little confused by what you mean when you say that the C rand() needs to be initialized every time its used.... it really only needs to be seeded *once* per session. Re-seeding before every call will actually break the "randomness" of the results. Also... the C rand() function doesnt make use of the BIOS in any way.

    256 player+ multiplayer!

    ... host tens of thousands of players on one box ...
    :confused: I think you misspelled the phrase "server cluster" as "box"... :lol:

    Random Number Generator

    actually, it does. the rand() function just uses whatever is in the os, which, in windows, is the bios call. not sure about linux, i should look that up...
    No.

    Here is the exact code for the Visual C rand() function:

    int __cdecl rand ( void )
    {
    return(((holdrand = holdrand * 214013L + 2531011L) >> 16) & 0x7fff);
    }

    "holdrand" is the random seed. As you can see, there are no BIOS calls of any kind. Note that the seed gets reset with the last random number generated... this is imporatant and brings us to the next point...



    as for initializing, at least in windows, if you initialize with something that changes, say, seconds since 1970 or something like that, it won't break the randomness, and will actually improve it. the bios rng gets stuck generating the same number over and over, because the function has difficulty changing very large or very small numbers.
    No.

    Imagine this bit of code that re-initializes the random seed to the time in seconds before every call...

    ...
    for( int i=0; i<10000; i++ )
    {
    srand( get_time_in_seconds_sinze_1970() );
    my_rand = rand();
    }
    ...

    Want to guess what will happen? "my_rand" will probably be the same for every single call to rand(). This is because this loop will probably be able to exectue all 10000 cycles within the same second. Without reseeding, you'll get 10000 mostly-random numbers. Dont believe me? Go look at the source to rand() again...


    Quote: anyway, i've done the chi square test on the c rand() function, it fails. and, it should be relatively trivial to fix, especially if you're using c++. just override. btw, it fails with initialization too, just not as badly.
    Eh?

    I have no idea how you've set up your test... and without knowing I cant really comment other than to say that given what else you've said, I'm beginning to doubt its validity. What was the exact result from the Chi-squared test? The results are not simply pass/fail but rather a relative value.
     
    Last edited by a moderator: Jan 3, 2018
  2. chevalier

    chevalier Knight of Everfull Chalice ★ SPS Account Holder Veteran

    Joined:
    Dec 14, 2002
    Messages:
    16,815
    Media:
    11
    Likes Received:
    58
    Gender:
    Male
    This is obviously NWN2. Can't correct the title because it returns an error.
     
Sorcerer's Place is a project run entirely by fans and for fans. Maintaining Sorcerer's Place and a stable environment for all our hosted sites requires a substantial amount of our time and funds on a regular basis, so please consider supporting us to keep the site up & running smoothly. Thank you!

Sorcerers.net is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to products on amazon.com, amazon.ca and amazon.co.uk. Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.