Subject: Rnadom numbers
From: [email-masked] (Bartlee A. Anderson)

8 Jan 1998 23:40:22 -0800
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: [email-masked]

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.                                [email-masked]
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
"[email-masked]" with one line of text: "help".