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,532 of 243,242    |
|    Michael Sanders to James Kuyper    |
|    Re: srand(0)    |
|    23 Dec 25 07:17:05    |
      From: porkchop@invalid.foo              On Mon, 22 Dec 2025 06:44:42 -0500, James Kuyper wrote:              > On 2025-12-22 03:48, Michael Sanders wrote:       >> Is it incorrect to use 0 (zero) to seed srand()?       >>       >> int seed = (argc >= 2 && strlen(argv[1]) == 9)       >> ? atoi(argv[1])       >> : (int)(time(NULL) % 900000000 + 100000000);       >>       >> srand(seed);       >       > No, why whould you think so?              Excuse my delayed reply James (net provider was down most of today).              Well, I guess I did not expect such large differences between       gcc & musl somehow (cant test with clang just yet). I understand the       sequence is deterministic & likely still some differences with musl,       yet I wrongly assumed it seems, the sequences would be the same...              #include |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca