rand_r()

Reentrant function to generate a pseudo-random integer value.

  #include <extras/extras_stdlib.h>
  
  int rand_r(unsigned int *context);    
Parameter

context

The seed value.

Remarks

The rand_r() function provides the same service as rand(), yet it also combines the functionality of srand() as well. The result of rand_r() is equivalent to calling srand() with a context seed value, then calling rand(). The difference is that for rand_r(), the caller provides the storage for the context seed value.

This function may require extra library support.

This facility is not specified in the ISO/IEC standards. It is an EWL extension of the standard libraries.