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,529 of 243,242    |
|    Janis Papanagnou to Michael S    |
|    Re: srand(0)    |
|    22 Dec 25 22:57:27    |
      From: janis_papanagnou+ng@hotmail.com              On 2025-12-22 19:45, Michael S wrote:       > [...] LFSR is a reasonably good PRNG for a single bit, but       > not when you want to generate a group of 31 pseudo-random bits. In       > order to get 31 new bits, without predictable repetitions from the       > previous value, you would have to do 31 steps. That's slow! The process       > can be accelerate by generation of several bits at time via look up       > tables, but in order to get decent speed the table has to be rater big       > and using big tables in standard library is bad sportsmanship.              Yes. But mind that the speed is also depending on what quality you       need. For example; I used the PN-generator to create bit-sequences       (as you also suggest). For another application both, PN-LFSR and       LCG (that you mention below), were inacceptable; we used a cipher       to create the random data. (If you compare the speed of creating       the cipher to a bit-shift-register the latter looks really fast.)              >       > It seems that overwhelming majority C RTLs use Linear Congruential       > Generators, probably because for Stanadard library compactness of both       > code and data is considered more important than very high speed (not       > that on modern HW LCGs are slow) or superior random properties of       > Mersenne Twisters.              For "standard applications" I always used the simple LCGs; simple       and fast. Or whatever the tools or library provided; which were       mostly anyway LCGs.              Janis              > [...]              --- 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