SW500010 Microchip Technology, SW500010 Datasheet - Page 285

HI-TECH C PRO FOR PIC10/12/16

SW500010

Manufacturer Part Number
SW500010
Description
HI-TECH C PRO FOR PIC10/12/16
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC10/12/16r
Datasheets

Specifications of SW500010

Supported Families
PIC10, PIC12, PIC16
Core Architecture
PIC
Software Edition
Professional
Kit Contents
Software And Docs
Mcu Supported Families
PIC10/12/16
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC10, PIC12, PIC14, PIC16, PIC16E
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
019P
778-1006
778-1006
Library Functions
SRAND
Synopsis
Description
The srand() function initializes the random number generator accessed by rand() with the given
seed. This provides a mechanism for varying the starting point of the pseudo-random sequence
yielded by rand(). On the Z80, a good place to get a truly random seed is from the refresh register.
Otherwise timing a response from the console will do, or just using the system time.
Example
See Also
rand()
#include <stdlib.h>
void srand (unsigned int seed)
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
void
main (void)
{
}
time_t toc;
int i;
time(&toc);
srand((int)toc);
for(i = 0 ; i != 10 ; i++)
putchar(’\n’);
printf("%d\t", rand());
285

Related parts for SW500010