Keil Logo

rand

Summary
int rand (int seed)  /* return a 16-bit random number */
Description

The rand function returns a random number in the range 0 to +32767. The random number generator is reinitialized each time a non-zero value is passed in the seed argument. You may use the rand function to delay for a random number of clock cycles or to generate random data to feed into a particular algorithm or input routine.

Return Value

The rand function returns and int value to the caller.

Example
>rand (0x1234) /* Initialize random generator with 0x1234 */
0x3B98

>rand (0) /* No initialization */
0x64BD
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.