From: Newsgroups: comp.os.msdos.djgpp Subject: Re: Fast random number generator Date: 15 Jul 1997 03:09:16 GMT Organization: CICNet Chicago server 2 Lines: 47 Message-ID: <01bc90cc$81dffec0$d1488cd0@scochran.SHOALSnet.com> References: <33C91424 DOT 7615 AT wanadoo DOT fr> NNTP-Posting-Host: 208.140.72.209 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Alan Poppleton wrote in article <33C91424 DOT 7615 AT wanadoo DOT fr>... > I need a fast and simple algorithm which can produce a fairly random > number given two seeds - x and y. Any ideas? It MUST be SIMPLE and > FAST and it only needs to return a number between 0 and 15. okay.. Why don't you use standard C. It might be faster to use like chaos or list of random numbers. I haven't looked into it but this should work good for most applications. /*CODE*/ #include #include void randomxy( int&, int&); int main(void) { int foox, fooy; srandom(time(NULL)); randomxy(foox, fooy); return 0; } void randomxy(int &x, int &y) // using refrences speeds it up by using the actual varibles { int r = random(225); x = r / 15; y = r % 15; } /*End of CODE*/ There you are. I'm pretty sure it works, and it produces fairly random numbers. If you want speed you'll just have to use read a list of randomized numbers. Micah Cochran scochran AT shoalsnet DOT com