Date: Thu, 21 Nov 1996 14:43:41 +0300 (MSK) From: "Alexander V. Lukyanov" Message-Id: <199611211143.OAA06514@video.yars.free.net> To: djgpp AT delorie DOT com, fighteer AT cs DOT com, mad AT grupo DOT bfe DOT pt Subject: Re: Problems with djgpp 2.01 > It may have been a bug in the v2.00 version. Before I answered your > question I looked into the library source code for rand() and srand() > (in src/libc/ansi/stdlib/rand.c if you must know). The seed value for > the randomizer is a static global variable, which means it is _always_ > initialized to zero when your program is run. I cannot think of any way > in which v2.00 could have handled the coding without initializing to > zero, unless it ran srand() by default in startup (a kludgy solution). I don't know if it is declared in a standard, but I think rand() should always return the same sequence if srand is not used. Of course, I can do srand(0), but usually I don't have to. The use of such non-random sequences is very simple - debugging. If I want to debug my program which uses random numbers, I want it to use the same 'random' numbers on each invocation until it works correctly.