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,554 of 243,242   
   Keith Thompson to James Kuyper   
   Re: srand(0)   
   23 Dec 25 16:30:16   
   
   From: Keith.S.Thompson+u@gmail.com   
      
   James Kuyper  writes:   
   > On 2025-12-23 06:50, Michael S wrote:   
   >> On Tue, 23 Dec 2025 10:54:23 +0100   
   >> Janis Papanagnou  wrote:   
   >>   
   >>> On 2025-12-23 10:18, Michael S wrote:   
   > ...   
   >>>> MT19937-64 is available out of the box(*) in C++. But not in C,   
   >>>> unfortunately.   
   >>>   
   >>> This is really strange given that the name ("Mersenne Twister") is   
   >>> that prominent.   
   >>>   
   >>> Looking that up I find at least "C" code for MT19937 in Wikipedia   
   >>> https://de.wikipedia.org/wiki/Mersenne-Twister   
   >>> It's based on 32 bit logic it seems; interpreting your "MT19937-64"   
   >>> I assume you're looking for a 64 bit based version?   
   >>>   
   >>   
   >> "Available out of the box" in this sentence means "part of standard   
   >> library".   
   >   
   > Citation, please? I can find neither Mersenne nor "MT19937-64" anywhere   
   > in n5001.pdf, the latest draft version of the C++ standard that I have   
   > access to, which is dated 2024-12-17.   
      
   N5001 29.5.4.3 [rand.eng.mers] "Class template mersenne_twister_engine".   
      
   N5001 29.5.6 [rand.predef] "Engines and engine adaptors with predefined   
   parameters" defines "mt19937" and "mt19937_64".   
      
   Its description of the algorithm isn't very detailed, but it   
   does impose some very specific requirements.  For mt19937:   
   "Required behavior: The 10000th consecutive invocation of a   
   default-constructed object of type mt19937 produces the value   
   4123659995.".  For mt19937_64: "Required behavior: The 10000th   
   consecutive invocation of a default-constructed object of type   
   mt19937_64 produces the value 9981545732273789042."   
      
   If we're going to discuss this in any more detail (rather than   
   discussing random numbers in general), I suggest comp.lang.c++.   
      
   As already mentioned, there are implementations of mt19937 for C,   
   but unlike in C++ they aren't part of the standard library.   
      
   --   
   Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com   
   void Void(void) { Void(); } /* The recursive call of the void */   
      
   --- 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