rand_r man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



rand(3C)							      rand(3C)

NAME
     rand, srand, rand_r - simple random-number generator

SYNOPSIS
     #include <stdlib.h>

     int rand (void);

     int rand_r (unsigned int *seed);

     void srand (unsigned int seed);

DESCRIPTION
     rand uses a multiplicative congruent random-number generator with period
     2^32 that returns successive pseudo-random numbers in the range from 0 to
     (2^15)-1.

     The function srand uses the argument seed as a seed for a new sequence of
     pseudo-random numbers to be returned by subsequent calls to the function
     rand.  If the function srand is then called with the same seed value, the
     sequence of pseudo-random numbers will be repeated.  If the function rand
     is called before any calls to srand have been made, the same sequence
     will be generated as when srand is first called with a seed value of 1.

     rand_r is a reentrant version of rand.  If rand_r is called with the same
     initial value for *seed and the value of *seed is not changed between
     successive returns and calls to rand_r, the same sequence shall be
     generated.	 This function is useful when multiple threads in a process
     each wish to get their own repeatable pseudo-random number sequence.  The
     feature test macro _SGI_REENTRANT_FUNCTIONS should be defined to make
     this function visible.

NOTES
     The spectral properties of rand are limited.  drand48(3C) and random(3B)
     provide a much better, though more elaborate, random-number generator.

     In a multi-threaded program rand is made MP safe by single-threading
     access to the shared seed.	 For best performance threaded applications
     should use rand_r instead.

SEE ALSO
     drand48(3C), random(3B)

									Page 1

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net