Keil Logo


4.33 _srand_r()

Defined in stdlib.h, this is a reentrant version of the srand() function.


int _srand_r(struct _rand_state * buffer, unsigned int seed);
is a pointer to a user-supplied buffer storing the state of the random number generator.
is a seed for a new sequence of pseudo-random numbers to be returned by subsequent calls to _rand_r().


This function enables you to explicitly supply your own buffer that can be used for thread-local storage.
If _srand_r() is repeatedly called with the same seed value, the same sequence of pseudo-random numbers is repeated. If _rand_r() is called before any calls to _srand_r() have been made with the same buffer, undefined behavior occurs because the buffer is not initialized.
Non-ConfidentialPDF file icon PDF versionARM DUI0378H
Copyright © 2007, 2008, 2011, 2012, 2014-2016 ARM. All rights reserved. 
  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.