.\" -*- 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 "1 Noviembre 2020" "" "Manual del Programador de Linux" .SH NOMBRE drand48, erand48, lrand48, nrand48, mrand48, jrand48, srand48, seed48, lcong48 \- generan números pseudo\-aleatorios distribuidos uniformemente .SH SINOPSIS .nf \fB#include \fP .PP \fBdouble drand48(void);\fP .PP \fBdouble erand48(unsigned short \fP\fIxsubi\fP\fB[3]);\fP .PP \fBlong lrand48(void);\fP .PP \fBlong nrand48(unsigned short \fP\fIxsubi\fP\fB[3]);\fP .PP \fBlong mrand48(void);\fP .PP \fBlong jrand48(unsigned short \fP\fIxsubi\fP\fB[3]);\fP .PP \fBvoid srand48(long \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 .RS -4 Requisitos de Macros de Prueba de Características para glibc (véase \fBfeature_test_macros\fP(7)): .RE .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 DESCRIPCIÓN Estas funciones generan números seudo\-aleatorios usando el algoritmo congruente lineal y artimética de enteros de 48 bits. .PP Las funciones \fBdrand48()\fP y \fBerand48()\fP devuelven valores en coma flotante de doble precisión no negativos uniformemente distribuidos entre [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 Las funciones \fBsrand48\fP(), \fBseed48\fP() y \fBlcong48\fP() son funciones de inicialización, una de las cuales debe ser llamada antes de usar \fBdrand48\fP(), \fBlrand48\fP() o \fBmrand48\fP(). Las funciones \fBerand48\fP(), \fBnrand48\fP() y \fBjrand48\fP() no requieren que una función de inicialización sea llamada primero. .PP Todas las funciones trabajan generando una secuencia de enteros de 48 bits, \fIXi\fP, de acuerdo a la fórmula de congruencia lineal: .PP .in +4n .EX \fBXn+1 = (aXn + c) mod m, donde n >= 0\fP .EE .in .PP El parámetro \fIm\fP = 2^48, de aquí que la aritmética sea de 48 bits. A menos que se llame a \fBlcong48\fP(), \fIa\fP y \fIc\fP son: .PP .in +4n .EX \fBa = 0x5DEECE66D\fP \fBc = 0xB\fP .EE .in .PP El valor devuelto por cualquiera de las funciones \fBdrand48\fP(), \fBerand48\fP(), \fBlrand48\fP(), \fBnrand48\fP(), \fBmrand48\fP() o \fBjrand48\fP() es calculado primero al generar el próximo \fIXi\fP de 48 bits en la secuencia. Entonces se copia el número apropiado de bits, de acuerdo al tipo de dato a ser devuelto, desde los bits de mayor orden de \fIXi\fP, y se transforman en el valor devuelto. .PP Las funciones \fBdrand48\fP(), \fBlrand48\fP() y \fBmrand48\fP() guardan el último \fIXi\fP de 48 bits generado, en un búfr interno. Las funciones \fBerand48\fP(), \fBnrand48\fP() y \fBjrand48\fP() requieren que el programa que las llame proporcione almacenamiento para los sucesivos valores \fIXi\fP en el argumento vector \fIxsubi\fP. Las funciones se inicializan al colocar el valor inicial de \fIXi\fP en la cadena antes de llamar a la función la primera vez. .PP La función inicializadora \fBsrand48\fP() asigna los 32 bits de mayor orden de \fIXi\fP al argumento \fIseedval\fP. Los 16 bits de orden bajo se rellenan con un valor arbitrario 0x330E. .PP La función inicializadora \fBseed48\fP() asigna el valor de \fIXi\fP al valor de 48 bits especificado en el argumento vector \fIseed16v\fP. Los valores anteriores de \fIXi\fP se copian en un búfer interno y \fBseed48\fP() devuelve un puntero a este búfer interno. .PP La función inicializadora \fBlcong48\fP() permite al usuario especificar los valores iniciales para \fIXi\fP, \fIa\fP y \fIc\fP. En los elementos del argumento vector \fIparam[0\-2]\fP se especifica \fIXi\fP, en \fIparam[3\-5]\fP se especifica \fIa\fP, y en \fIparam[6]\fP se especifica \fIc\fP. Después de llamar a \fBlcong48\fP(), una llamada a \fBsrand48\fP() o \fBseed48\fP() puede restaurar los valores estándares de \fIa\fP y \fIc\fP. .SH ATRIBUTOS Para obtener una explicación de los términos usados en esta sección, véase \fBattributes\fP(7). .ad l .TS allbox; lb lb lb lw21 l lw22. Interfaz Atributo Valor T{ \fBdrand48\fP(), \fBerand48\fP(), \fBlrand48\fP(), \fBnrand48\fP(), \fBmrand48\fP(), \fBjrand48\fP(), \fBsrand48\fP(), \fBseed48\fP(), \fBlcong48\fP() T} Seguridad del hilo 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 "CONFORME A" POSIX.1\-2001, POSIX.1\-2008, SVr4. .SH "VÉASE TAMBIÉN" \fBrand\fP(3), \fBrandom\fP(3) .SH COLOFÓN Esta página es parte de la versión 5.10 del proyecto Linux \fIman\-pages\fP. Puede encontrar una descripción del proyecto, información sobre cómo informar errores y la última versión de esta página en \%https://www.kernel.org/doc/man\-pages/. .PP .SH TRADUCCIÓN La traducción al español de esta página del manual fue creada por Sebastian Desimone , Gerardo Aburruzaga García y Marcos Fouces . .PP Esta traducción es documentación libre; lea la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 .UE o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD. .PP Si encuentra algún error en la traducción de esta página del manual, envíe un correo electrónico a .MT debian-l10n-spanish@lists.debian.org .ME .