Thread: About rand

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    1

    About rand

    Hi all

    What algorithm is used in the built-in function rand() in C?

    Thanks in advance
    Fred

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > What algorithm is used in the built-in function rand() in C?
    It's random
    The standard doesn't specify a particular algorithm, so even from the same seed, two different implementations can return different results.

    Most tend to be variants of
    http://random.mat.sbg.ac.at/~charly/server/node3.html

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. rand() implementation
    By habert79 in forum C Programming
    Replies: 4
    Last Post: 02-07-2009, 01:18 PM
  2. Wm_timer
    By Ducky in forum Windows Programming
    Replies: 21
    Last Post: 09-26-2008, 05:36 AM
  3. Issue w/ Guess My Number Program
    By mkylman in forum C++ Programming
    Replies: 5
    Last Post: 08-23-2007, 01:31 AM
  4. rand() to choose?
    By wagman in forum C++ Programming
    Replies: 2
    Last Post: 03-27-2002, 01:43 AM
  5. rand () a little confusion
    By Led Zeppelin in forum C Programming
    Replies: 3
    Last Post: 03-19-2002, 10:13 PM