From: kevin AT reality-bytesX DOT demon DOT co DOT uk (Kevin) Newsgroups: comp.os.msdos.djgpp Subject: Re: random numbers in DJGPP (beginner ?) Date: Sun, 28 Jun 1998 13:10:45 GMT Message-ID: <35964088.7606185@news.demon.co.uk> References: <6n4oa8$fij$1 AT fir DOT prod DOT itd DOT earthlink DOT net> NNTP-Posting-Host: reality-bytes.demon.co.uk Lines: 32 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Try num = rand() % maxnum; where maxnum is the upper limit for the generated number Kev. Remove 'X' from address if you wish to Email me. On Sun, 28 Jun 1998 01:39:30 -0500, "Jason Nehf" wrote: >I am a real newbie to C/C++ and DJGPP, and i was wondering how to create >random numbers, in the style of > >Pseudocode: > >randomNum = random(int MaxNum); > >where randomNum is the random number returned and MaxNum is the maximum >value for randomNum, and the possible range is 0 to MaxNum. is there such a >routine, or will i have to build it from existing ones? I've searched the >RHIDE syntax help file and none of the routines it gave me were really what >i was looking for. Any help would be greatly appreciated. > >Jason Nehf > > h. > >I didn't know that; I've never had a copy of one of those compilers to >play with in Win95. Sounds like another good reason to use DJGPP. This is a general drawback in many Windows programs. Upon installation they copy DLLs all over the system and manipulate the registry. When you have to install the system anew because of a crash ( and I had severl even with NT though thats more stable) programs won't work because they are so spread over your drive. It doesn't matter that your installation files were never hurt you have to reinstall to be sure that everything works again. Funny thing is, when I had this problem I forgot to reinstall GhostView. After I started it it detected that there is something wrong and registered itself again, so there was no need to reinstall the entire package. An option I miss in many Windows programs. That's why I prefer programs that keep their stuff to itself. When you want to delete it, simply delete the directory and you are rid of it. When you need to copy it simply copy the directory tree and you have it. When you want to copy MS Office to another machine there is no way but installing it new and loosing all changes you made to your previous installation. -- Bye, Gerhard email: sparhawk AT eunet DOT at g DOT gruber AT sis DOT co DOT at Spelling corrections are appreciated.