From: jsinger AT expert DOT cc DOT purdue DOT edu (Jason Singer) Newsgroups: comp.os.msdos.djgpp Subject: Re: random() Date: 10 Jan 1997 19:23:33 GMT Organization: Purdue University Computing Center Lines: 36 Message-ID: <5b64vl$ldv@mozo.cc.purdue.edu> References: <5aouvm$erv AT cocoa DOT brown DOT edu> NNTP-Posting-Host: expert.cc.purdue.edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp : Is there a randomize() funtion for DJGPP? If so : which Lib is it in? I keep getting the same #'s : when I use the random() funtion, and I need : to randomize the # seed. I had the same problem, so I made my own. Here's what I use: void randomize(void) { int num = (int) time(NULL); if (num < 0) num = -num; srandom( num ); } // Gets a random integer from 0 to top - 1. int getRand(int top) { int num = (int) random(); if (num < 0) num = -num; return num % top; } Hope that helps, Jason ================================= Smile!!!!!!! \|/ O O -----ooooO----( )----Ooooo----- O And Have a Grrrrrrreat Day!!!!!!! =================================