home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 242,548 of 243,242   
   Richard Tobin to Scott Lurndal   
   Re: srand(0)   
   23 Dec 25 19:05:28   
   
   From: richard@cogsci.ed.ac.uk   
      
   In article ,   
   Scott Lurndal  wrote:   
      
   >>HISTORY   
   >>        rand()   
   >>        srand()   
   >>               SVr4, 4.3BSD, C89, POSIX.1-2001.   
      
   >Those interfaces were originally documented in the SVID   
   >(System V Interface Definition).   
      
   Not "originally".   
      
   >The third edition (1989) states:   
   >   
   > "The function rand() uses a multiplicative congruential random-number   
   >  generator with a period 2^32 that returns successive psuedo-random   
   >  numbers in the range 0 to 32767."   
      
   Unix 5th edition (page dated 1/15/73) says:   
      
     Rand uses a multiplicative congruential random number generator to   
     return successive pseudo-random numbers (in r0) in the range from 1   
     to 2^15-1.   
      
   (In those days they documented the assembler interface as well.)   
      
   The SVID r3 text is almost identical to 7th edition's (1979).   
      
   >In the FUTURE DIRECTIONS section, it notes:   
   >   
   > "The algorithms used in rand() and srand() are obsolete and will   
   >  be replaced with algorithms providing better pseudo-random characteristics   
   >  in a future issue".   
   >   
   >There was never a fourth edition.   
      
   There was, but it was post-Posix.  Rather than having improved   
   algorithms in [s]rand() it has "see also drand48".   
      
   https://www.sco.com/developers/devspecs/vol1a.pdf   
      
   -- Richard   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca