CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 1999
    Location
    Dublin, Ireland
    Posts
    64

    The run-time library rand() function

    Hi,

    Anybody got any idea what algorithm is used by the random number generator ?

    Thanks,

    Brendan


  2. #2
    Guest

    Re: The run-time library rand() function

    Have a look at the code. It's in the CRT\SRC subdirectory.


  3. #3
    Join Date
    Apr 1999
    Location
    Dublin, Ireland
    Posts
    64

    Re: The run-time library rand() function

    Hi,

    I don't have a CRT/SRC directory !!! What's the full path of yours ?

    Brendan


  4. #4
    Join Date
    May 1999
    Location
    WA
    Posts
    65

    Re: The run-time library rand() function

    When you installed VC did you include all of the MFC source, the debug code, etc?? If not, you may want to go add those, then you will have the directory!

    - Troy

  5. #5
    Join Date
    May 1999
    Posts
    123

    Re: The run-time library rand() function

    Glancing at the source code, it's a 32-bit linear-congruential generator with a multiplier of 214013 and an addend of 2531011. It returns only the top 16 bits generated.



    The universe is a figment of its own imagination.

  6. #6
    Join Date
    May 1999
    Posts
    23

    Re: The run-time library rand() function

    There is a book that talks about random number generators that you might find interesting called Advanced C (Second Edition) from Osborne McGraw-Hill. ISBN 0-07-881348-4.


  7. #7
    Join Date
    Apr 1999
    Location
    Dublin, Ireland
    Posts
    64

    Re: The run-time library rand() function

    Thanks Orion,

    Brendan


  8. #8
    Join Date
    Apr 1999
    Location
    Dublin, Ireland
    Posts
    64

    Re: The run-time library rand() function

    Thanks Jerry,

    Brendan


  9. #9
    Join Date
    Apr 1999
    Location
    Dublin, Ireland
    Posts
    64

    Re: The run-time library rand() function

    Thanks Troy,

    Brendan


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured