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,544 of 243,242   
   Michael Sanders to David Brown   
   Re: srand(0)   
   23 Dec 25 14:45:26   
   
   From: porkchop@invalid.foo   
      
   On Tue, 23 Dec 2025 08:25:59 +0100, David Brown wrote:   
      
   > It is not the compilers that are different, it is the C standard   
   > libraries that are different.  gcc is a compiler, not a library, but you   
   > are probably using glibc with it by default.  musl is a library, not a   
   > compiler.  There is no reason to suppose that different C standard   
   > libraries use the same implementation of rand()and srand(), so no reason   
   > to suppose they would give the same sequences - though each on their own   
   > will give a deterministic pseudo-random sequence based on their seeds.   
   >   
   > If you swap gcc with clang you will get the same results - it will   
   > depend on whether you are linking with glibc, musl, or another C library.   
      
   Sure enough & thank you David - I appreciate your explanation.   
      
   I see where my thinking was off now. You're 100% correct   
   (I'm still learning as you noticed).   
      
   --   
   :wq   
   Mike Sanders   
      
   --- 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