.\" -*- 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 novembro 2020" "" "Manual do Programador do Linux" .SH NOME drand48, erand48, lrand48, nrand48, mrand48, jrand48, srand48, seed48, lcong48 \- gera números pseudo\-randômicos distribuidos uniformemente .SH SINOPSE .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 macro de teste de recursos para o glibc (consulte \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 DESCRIÇÃO Essas funções geram números pseudo\-randômicos usando o algoritmo de congruência linear e aritmética inteira de 48\-bit. .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 As funções \fBsrand48\fP(), \fBseed48\fP() e \fBlcong48\fP() são funções de inicialização, as quais deve ser chamadas antes do uso de \fBdrand48\fP(), \fBlrand48\fP() ou \fBmrand49\fP(). As funções \fBerand48\fP(), \fBnrand48\fP() e \fBjrand48\fP() não requerem a chamada da função de inicialização primeiro. .PP Todas as funções trabalham gerando uma sequencia de inteiros 48\-bit, \fIXi\fP, de acordo com a formula de congruência linear: .PP .in +4n .EX \fBXn+1 = (aXn + c) mod m, onde n >= 0\fP .EE .in .PP O parâmetro \fIm\fP = 2^48, portanto uma aritmética de inteiro 48\-bit é realizada.A não ser que \fBlcong48\fP() seja chamada, \fIa\fP e \fIc\fP são obtidos por: .PP .in +4n .EX \fBa = 0x5DEECE66D\fP \fBc = 0xB\fP .EE .in .PP O valor retornado por qualquer uma das funções \fBdrand48\fP(), \fBerand48\fP(), \fBlrand48\fP(), \fBnrand48\fP(), \fBmrand48\fP() ou \fBjrand48\fP() é computado para primeira geração do próximo 48\-bit \fIXi\fP na sequência. Então, o número apropriado de bits, de acordo com o tipo de item de dado a ser retornado, é copiado dos bits de mais alta ordem de \fIXi\fP e transformado no valor retornado. .PP As funções \fBdrand48\fP(), \fBlrand48\fP() e \fBmrand48\fP() armazenam o último 48\-bit \fIXi\fP gerado em um buffer interno. As funções \fBerand48\fP(), \fBnrand48\fP() e \fBjrand48\fP() requerem que o programa chamador providencie armazenamento para os valores sucessivos de \fIXi\fP no argumento vetor \fIxsubi\fP. As funções são inicializadas pela colocação do valor inicial de \fIXi\fP no vetor antes da primeira chamada as funções. .PP A função de inicialização \fBsrand48\fP() ajusta os 32\-bits de mais alta ordem de \fIXi\fP para o argumento \fIseedval\fP. Os 16\-bits de mais baixa ordem são ajustados arbitrariamente para o valor 0x330E. .PP A função de inicialização \fBseed48\fP() seta o valor de \fIXi\fP para o valor 48\-bit especificado no argumento vetor \fIseed16v\fP. O valor anterior de \fIXi\fP é copiado em um buffer interno e um ponteiro para esse buffer é retornado por \fBseed48\fP(). .PP A função de inicialização \fBlcong48\fP() permite ao usuário especificar valores iniciais para \fIXi\fP, \fIa\fP e \fIc\fP. O elemento \fIparam[0\-2]\fP do argumento vetor especifica \fIXi\fP, \fIparam[3\-5]\fP especifica \fIa\fP, e \fIparam[6]\fP especifica \fIc\fP. Após a chamada de \fBlcong48\fP(), uma chamada subsequente a \fBsrand48\fP() ou \fBseed48\fP() irá restaurar os valores padrão de \fIa\fP e \fIc\fP. .SH ATRIBUTOS Para uma explicação dos termos usados nesta seção, consulte \fBattributes\fP(7). .ad l .TS allbox; lb lb lb lw21 l lw22. Interface Atributo Valor T{ \fBdrand48\fP(), \fBerand48\fP(), \fBlrand48\fP(), \fBnrand48\fP(), \fBmrand48\fP(), \fBjrand48\fP(), \fBsrand48\fP(), \fBseed48\fP(), \fBlcong48\fP() T} Thread safety 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 "DE ACORDO COM" POSIX.1\-2001, POSIX.1\-2008, SVr4. .SH "VEJA TAMBÉM" \fBrand\fP(3), \fBrandom\fP(3) .SH COLOFÃO Esta página faz parte da versão 5.10 do projeto Linux \fIman\-pages\fP. Uma descrição do projeto, informações sobre relatórios de bugs e a versão mais recente desta página podem ser encontradas em \%https://www.kernel.org/doc/man\-pages/. .PP .SH TRADUÇÃO A tradução para português brasileiro desta página man foi criada por Marcelo D. Beckmann e André Luiz Fassone . .PP Esta tradução é uma documentação livre; leia a .UR https://www.gnu.org/licenses/gpl-3.0.html Licença Pública Geral GNU Versão 3 .UE ou posterior para as condições de direitos autorais. Nenhuma responsabilidade é aceita. .PP Se você encontrar algum erro na tradução desta página de manual, envie um e-mail para .MT debian-l10n-portuguese@lists.debian.org a lista de discussão de tradutores .ME .