From: Ahn Ki-yung Newsgroups: comp.os.msdos.djgpp Subject: What does "srand" and "srandom" do? Date: Fri, 06 Mar 1998 18:37:42 +0900 Organization: Korea Telecom Lines: 38 Message-ID: <34FFC3E3.8465FB75@mail.hitel.net> Reply-To: 96046 AT mail DOT seoul-shs DOT seoul DOT kr NNTP-Posting-Host: dor20326.kaist.ac.kr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I wonder what does these libc functions do ? In the libc reference info file there are 3 random functions. They are rand, random, srandom. The function "rand(unsigned int)" is not found but there is a prototype in "stdlib.h" Anyway the info file says about the function srandom like this > srandom > ======= > Syntax > ------ > #include > int srandom(int seed); > > Description > ----------- > This function initialized the random number generator (random.). > Passing the same SEED results in `random' returning predictable > sequences of numbers. > > Return Value > ------------ > Zero. > > Example > ------- > srandom(45); What does this mean. I can't get any idea from the example. So I tried to find out the difference before calling the function "srandom" I tried several times but I couldn't find any difference! The return value of "random( )" was unpredictable all the time, before and after calling the functions "srandom". Please help me how to use this function.