table of contents
other versions
- wheezy 3.44-1
- jessie 3.74-1
- jessie-backports 4.10-2~bpo8+1
- testing 4.10-2
- unstable 4.10-2
DRAND48(3) | Linux Programmer's Manual | DRAND48(3) |
NAME¶
drand48, erand48, lrand48, nrand48, mrand48, jrand48, srand48, seed48, lcong48 - generate uniformly distributed pseudo-random numbersSYNOPSIS¶
#include <stdlib.h>double drand48(void);double erand48(unsigned short xsubi[3]);long int lrand48(void);long int nrand48(unsigned short xsubi[3]);long int mrand48(void);long int jrand48(unsigned short xsubi[3]);void srand48(long int seedval);unsigned short *seed48(unsigned short seed16v[3]);void lcong48(unsigned short param[7]);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
DESCRIPTION¶
These functions generate pseudo-random numbers using the linear congruential algorithm and 48-bit integer arithmetic. The drand48() and erand48() functions return nonnegative double-precision floating-point values uniformly distributed between [0.0, 1.0). The lrand48() and nrand48() functions return nonnegative long integers uniformly distributed between 0 and 2^31. The mrand48() and jrand48() functions return signed long integers uniformly distributed between -2^31 and 2^31. The srand48(), seed48() and lcong48() functions are initialization functions, one of which should be called before using drand48(), lrand48() or mrand48(). The functions erand48(), nrand48() and jrand48() do not require an initialization function to be called first. All the functions work by generating a sequence of 48-bit integers, Xi, according to the linear congruential formula:Xn+1 = (aXn + c) mod m, where n >= 0
a = 0x5DEECE66D c = 0xB
CONFORMING TO¶
SVr4, POSIX.1-2001.NOTES¶
These functions are declared obsolete by SVID 3, which states that rand(3) should be used instead.SEE ALSO¶
rand(3), random(3)COLOPHON¶
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.2007-07-26 |