NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | NOTE | ATTRIBUTES | SEE ALSO | STANDARDS
$(NUCLEUS_DIR)/lib/classix/libsys.s.a #include <stdlib.h>void srand(unsigned seed);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
The rand() function computes a sequence of pseudo-random integers in the range of 0 to RAND_MAX (as defined by the header file stdlib.h ).
The srand() function sets its argument as the seed for a new sequence of pseudo-random numbers to be returned by rand() . These sequences are repeatable by calling srand() with the same seed value.
If no seed value is provided, the functions are automatically seeded with a value of 1.
Though these functions are reentrant, the state information is global to the actor. Therefore, repeatability of a given suite of numbers will not be experienced by several threads in parallel. For a reentrant repeatability of suites, see rand_r (3STDC).
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
The rand() and srand() functions conform to ANSI-C.
NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | NOTE | ATTRIBUTES | SEE ALSO | STANDARDS