Mail Archives: cygwin/1998/01/08/23:40:22
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 <stdio.h>
#include <stdlib.h>
#include <winbase.h>
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 <no_warranties>
#include <other_disclaimers>
--
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".
- Raw text -