17.05.2015 Views

TMS34010 C Compiler - Al Kossow's Bitsavers

TMS34010 C Compiler - Al Kossow's Bitsavers

TMS34010 C Compiler - Al Kossow's Bitsavers

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Random Integer<br />

rand/srand<br />

Syntax #include <br />

Defined in<br />

Description<br />

int rand()<br />

void srand(seed)<br />

unsigned int seed;<br />

rand. c in rts. src<br />

Two functions work together to provide pseudo-random sequence generation:<br />

• The rand function returns pseudo-random integers in the range<br />

Q-RAN D-MAX.<br />

• The srand function sets the value of seed so that a subsequent call<br />

to the rand function produces a new sequence of pseudo~random<br />

numbers. The srand function does not return a value.<br />

If you call rand before calling srand, rand generates the same sequence it<br />

would produce if you first called srand with a seed value of 1. If you call<br />

srand with the same seed value, rand generates the same sequence of<br />

numbers.<br />

6-61

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!