man-pages/man3/drand48_r.3.html
2021-03-31 01:06:50 +01:00

171 lines
4.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of DRAND48_R</TITLE>
</HEAD><BODY>
<H1>DRAND48_R</H1>
Section: Linux Programmer's Manual (3)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
drand48_r, erand48_r, lrand48_r, nrand48_r, mrand48_r, jrand48_r,
srand48_r, seed48_r, lcong48_r
- generate uniformly distributed pseudo-random numbers reentrantly
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
<B>#include &lt;<A HREF="file:///usr/include/stdlib.h">stdlib.h</A>&gt;</B>
<B>int drand48_r(struct drand48_data *</B><I>buffer</I><B>, double *</B><I>result</I><B>);</B>
<B>int erand48_r(unsigned short </B><I>xsubi</I><B>[3]</B><I>,</I>
<B> struct drand48_data *buffer</B><I>, double *</I><B>result</B><I>);</I>
<B>int lrand48_r(struct drand48_data *</B><I>buffer</I><B>, long int *</B><I>result</I><B>);</B>
<B>int nrand48_r(unsigned short int </B><I>xsubi[3]</I><B>,</B>
<B> struct drand48_data *buffer</B><I>, long int *</I><B>result</B><I>);</I>
<B>int mrand48_r(struct drand48_data *</B><I>buffer</I><B>,long int *</B><I>result</I><B>);</B>
<B>int jrand48_r(unsigned short int </B><I>xsubi[3]</I><B>,</B>
<B> struct drand48_data *</B><I>buffer</I><B>, long int *</B><I>result</I><B>);</B>
<B>int srand48_r(long int </B><I>seedval</I><B>, struct drand48_data *</B><I>buffer</I><B>);</B>
<B>int seed48_r(unsigned short int </B><I>seed16v[3]</I><B>,</B>
<B> struct drand48_data *</B><I>buffer</I><B>);</B>
<B>int lcong48_r(unsigned short int </B><I>param[7]</I><B>,</B>
<B> struct drand48_data *</B><I>buffer</I><B>);</B>
</PRE>
<P>
Feature Test Macro Requirements for glibc (see
<B><A HREF="/cgi-bin/man/man2html?7+feature_test_macros">feature_test_macros</A></B>(7)):
<P>
All functions shown above:
<BR>&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Glibc&nbsp;since&nbsp;2.19:&nbsp;*/&nbsp;_DEFAULT_SOURCE
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;/*&nbsp;Glibc&nbsp;versions&nbsp;&lt;=&nbsp;2.19:&nbsp;*/&nbsp;_SVID_SOURCE&nbsp;||&nbsp;_BSD_SOURCE
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
These functions are the reentrant analogs of the functions described in
<B><A HREF="/cgi-bin/man/man2html?3+drand48">drand48</A></B>(3).
Instead of modifying the global random generator state, they use
the supplied data
<I>buffer</I>.
<P>
Before the first use, this struct must be initialized, for example,
by filling it with zeros, or by calling one of the functions
<B>srand48_r</B>(),
<B>seed48_r</B>(),
or
<B>lcong48_r</B>().
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
The return value is 0.
<A NAME="lbAF">&nbsp;</A>
<H2>ATTRIBUTES</H2>
For an explanation of the terms used in this section, see
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
<TABLE BORDER>
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
<TR VALIGN=top><TD>
<B>drand48_r</B>(),
<B>erand48_r</B>(),
<B>lrand48_r</B>(),
<B>nrand48_r</B>(),
<B>mrand48_r</B>(),
<B>jrand48_r</B>(),
<B>srand48_r</B>(),
<B>seed48_r</B>(),
<B>lcong48_r</B>()
</TD><TD>Thread safety</TD><TD>MT-Safe race:buffer<BR></TD></TR>
</TABLE>
<A NAME="lbAG">&nbsp;</A>
<H2>CONFORMING TO</H2>
These functions are GNU extensions and are not portable.
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?3+drand48">drand48</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+rand">rand</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+random">random</A></B>(3)
<A NAME="lbAI">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="4"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="5"><A HREF="#lbAF">ATTRIBUTES</A><DD>
<DT id="6"><A HREF="#lbAG">CONFORMING TO</A><DD>
<DT id="7"><A HREF="#lbAH">SEE ALSO</A><DD>
<DT id="8"><A HREF="#lbAI">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:39 GMT, March 31, 2021
</BODY>
</HTML>