.\" -*- coding: UTF-8 -*- .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" References consulted: .\" Linux libc source code .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) .\" 386BSD man pages .\" Modified Sat Jul 24 19:46:03 1993 by Rik Faith (faith@cs.unc.edu) .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH DRAND48 3 "15 septembre 2017" "" "Manuel du programmeur Linux" .SH NOM drand48, erand48, lrand48, nrand48, mrand48, jrand48, srand48, seed48, lcong48 \- Générer de nombres pseudoaléatoires uniformément distribués .SH SYNOPSIS .nf \fB#include \fP .PP \fBdouble drand48(void);\fP .PP \fBdouble erand48(unsigned short \fP\fIxsubi\fP\fB[3]);\fP .PP \fBlong int lrand48(void);\fP .PP \fBlong int nrand48(unsigned short \fP\fIxsubi\fP\fB[3]);\fP .PP \fBlong int mrand48(void);\fP .PP \fBlong int jrand48(unsigned short \fP\fIxsubi\fP\fB[3]);\fP .PP \fBvoid srand48(long int \fP\fIseedval\fP\fB);\fP .PP \fBunsigned short *seed48(unsigned short \fP\fIseed16v\fP\fB[3]);\fP .PP \fBvoid lcong48(unsigned short \fP\fIparam\fP\fB[7]);\fP .fi .PP .in -4n Exigences de macros de test de fonctionnalités pour la glibc (consulter \fBfeature_test_macros\fP(7))\ : .in .PP .ad l .\" .BR drand48 (), .\" .BR erand48 (), .\" .BR lrand48 (), .\" .BR nrand48 (), .\" .BR mrand48 (), .\" .BR jrand48 (), .\" .BR srand48 (), .\" .BR seed48 (), .\" .BR lcong48 (): All functions shown above: _XOPEN_SOURCE || /* Glibc since 2.19: */ _DEFAULT_SOURCE || /* Glibc versions <= 2.19: */ _SVID_SOURCE .ad b .SH DESCRIPTION Ces fonctions génèrent des nombres pseudoaléatoires en utilisant un algorithme de congruence linéaire, et une arithmétique entière sur 48\ bits. .PP The \fBdrand48\fP() and \fBerand48\fP() functions return nonnegative double\-precision floating\-point values uniformly distributed over the interval [0.0,\ 1.0). .PP The \fBlrand48\fP() and \fBnrand48\fP() functions return nonnegative long integers uniformly distributed over the interval [0,\ 2^31). .PP The \fBmrand48\fP() and \fBjrand48\fP() functions return signed long integers uniformly distributed over the interval [\-2^31,\ 2^31). .PP Les fonctions \fBsrand48\fP(), \fBseed48\fP() et \fBlcong48\fP() sont des fonctions d'initialisation. L'une d'entre elles doit être appelée avant d'utiliser les fonctions \fBdrand48\fP(), \fBlrand48\fP() ou \fBmrand48\fP(). Les fonctions \fBerand48\fP(), \fBnrand48\fP() et \fBjrand48\fP() ne nécessitent pas de fonction d'initialisation. .PP Toutes ces fonctions engendrent une séquence d'entiers \fIXi\fP, sur 48\ bits, suivant la formule de congruence linéaire\ : .PP .in +4n .EX \fBXn+1 = (aXn + c) mod m, avec n >= 0\fP .EE .in .PP Le paramètre \fIm\fP vaut 2^48, ainsi l'arithmétique entière sur 48\ bits est respectée. Tant que \fBlcong48\fP() n'est pas appelé, \fIa\fP et \fIc\fP valent\ : .PP .in +4n .EX \fBa = 0x5DEECE66D\fP \fBc = 0xB\fP .EE .in .PP Les valeurs renvoyées par les fonctions \fBdrand48\fP(), \fBerand48\fP(), \fBlrand48\fP(), \fBnrand48\fP(), \fBmrand48\fP() ou \fBjrand48\fP() sont calculées en générant les \fIXi\fP suivant sur 48\ bits dans la séquence. Ensuite, le nombre de bits approprié au type de la valeur de retour est copié en partant des bits de poids fort de \fIXi\fP, et convertit dans la valeur renvoyée. .PP Les fonctions \fBdrand48\fP(), \fBlrand48\fP() et \fBmrand48\fP() mémorisent le dernier \fIXi\fP sur 48\ bits créé dans un tampon interne. Les fonctions \fBerand48\fP(), \fBnrand48\fP() et \fBjrand48\fP() nécessitent que le programme appelant fournisse un emplacement de stockage pour les valeurs successives de \fIXi\fP. Cet emplacement est le tableau correspondant à l'argument \fIxsubi\fP. Ces fonctions sont initialisées en plaçant la valeur initiale de \fIXi\fP dans le tableau avant le premier appel. .PP La fonction d'initialisation \fBsrand48\fP() définit les 32\ bits de poids fort de \fIXi\fP avec l'argument \fIseedval\fP. Les 16\ bits de poids faible sont initialisés avec la valeur arbitraire 0x330E. .PP La fonction d'initialisation \fBseed48\fP() définit la valeur de \fIXi\fP comme la valeur spécifiée dans le tableau \fIseed16v\fP. La précédente valeur de \fIXi\fP est copiée dans un tampon interne et un pointeur vers ce tampon est renvoyé par \fBseed48\fP(). .PP La fonction d'initialisation \fBlcong48\fP() permet à l'utilisateur de définir des valeurs initiales de \fIXi\fP, \fIa\fP et \fIc\fP. Les éléments \fIparam[0\-2]\fP du tableau spécifient \fIXi\fP, \fIparam[3\-5]\fP spécifient \fIa\fP et \fIparam[6]\fP spécifie \fIc\fP. Après un appel à \fBlcong48\fP(), un appel ultérieur à \fBsrand48\fP() ou à \fBseed48\fP() rétablira les valeurs normales de \fIa\fP et \fIc\fP. .SH ATTRIBUTS Pour une explication des termes utilisés dans cette section, consulter \fBattributes\fP(7). .ad l .TS allbox; lb lb lb lw21 l lw22. Interface Attribut Valeur T{ \fBdrand48\fP(), \fBerand48\fP(), \fBlrand48\fP(), \fBnrand48\fP(), \fBmrand48\fP(), \fBjrand48\fP(), \fBsrand48\fP(), \fBseed48\fP(), \fBlcong48\fP() T} Sécurité des threads T{ MT\-Unsafe race:drand48 T} .TE .ad .PP The above functions record global state information for the random number generator, so they are not thread\-safe. .SH CONFORMITÉ POSIX.1\-2001, POSIX.1\-2008, SVr4. .SH "VOIR AUSSI" \fBrand\fP(3), \fBrandom\fP(3) .SH COLOPHON Cette page fait partie de la publication\ 5.04 du projet \fIman\-pages\fP Linux. Une description du projet et des instructions pour signaler des anomalies et la dernière version de cette page peuvent être trouvées à l'adresse \%https://www.kernel.org/doc/man\-pages/. .SH TRADUCTION La traduction française de cette page de manuel a été créée par Christophe Blaess , Stéphan Rafin , Thierry Vignaud , François Micaux, Alain Portal , Jean-Philippe Guérard , Jean-Luc Coulon (f5ibh) , Julien Cristau , Thomas Huriaux , Nicolas François , Florentin Duneau , Simon Paillard , Denis Barbier et David Prévot . Cette traduction est une documentation libre ; veuillez vous reporter à la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License version 3 .UE concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE. Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à .MT debian-l10n-french@lists.debian.org .ME .