From: banders AT ECD DOT Rockwell DOT COM (Bartlee A. Anderson) Subject: Rnadom numbers 8 Jan 1998 23:40:22 -0800 Message-ID: <34B5631E.35A2.cygnus.gnu-win32@switch.rockwell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: gnu-win32 AT cygnus DOT com After I figured out how to do random and eliminated the access violation when trying to do time functions, here's a little more random version for getting different numbers for different runs. program listing --------------- #include #include #include main() { int myvalue; static SYSTEMTIME SystemTime; GetSystemTime(&SystemTime); srand(SystemTime.wMilliseconds); /* use millisecond timer as seed for srand * myvalue = rand(); srand(myvalue); /* more randomness */ myvalue = ((float)rand()/RAND_MAX)*100.0; /* scale from 0 to 100 */ printf("%d\n",myvalue); myvalue = ((float)rand()/RAND_MAX)*100.0; /* scale from 0 to 100 */ printf("%d\n",myvalue); } Seems to work fine for me. Donated to public domain #include #include -- Bartlee A. Anderson System Test (Interfaces-Tools-Automation-ISDN) Rockwell International Electronic Commerce Division 300 Bauman Ct. banders AT ecd DOT rockwell DOT com MS 933-605 Opinions my own, not Rockwell's VOICE (630) 227-8975 Wood Dale, IL 60191 FAX (630) 227-9771 - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".