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,880 of 243,242   
   Tim Rentsch to Michael S   
   Re: srand(0)   
   07 Jan 26 07:46:40   
   
   From: tr.17687@z991.linuxsc.com   
      
   Michael S  writes:   
      
   [regarding rand() and srand()]   
      
   > Pay attention that C Standard only requires for the same seed to always   
   > produces the same sequence.  There is no requirement that different   
   > seeds have to produce different sequences.   
   > So, for generator in your example, implementation like below would be   
   > fully legal.  Personally, I wouldn't even consider it as particularly   
   > poor quality:   
   >   
   > void srand(unsigned seed ) { init = seed | 1;}   
      
   It seems better to do, for example,   
      
     void srand(unsigned seed ) { init = seed - !seed;}   
      
   --- 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