SW500007 Microchip Technology, SW500007 Datasheet - Page 272

PICC-18 PRO

SW500007

Manufacturer Part Number
SW500007
Description
PICC-18 PRO
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC18r
Datasheets

Specifications of SW500007

Supported Families
PIC18
Core Architecture
PIC
Software Edition
Professional
Kit Contents
Software And Docs
Mcu Supported Families
PIC18
Tool Function
Compiler
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / RoHS Compliant
For Use With/related Products
PIC18 Series
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
015P
778-1002
778-1002
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()
258
#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());
Library Functions

Related parts for SW500007