.\" -*- 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 listopada 2020 r." "" "Podręcznik programisty Linuksa" .SH NAZWA drand48, erand48, lrand48, nrand48, mrand48, jrand48, srand48, seed48, lcong48 \- generowanie jednolicie rozłożonych liczb pseudolosowych .SH SKŁADNIA .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 Wymagane ustawienia makr biblioteki glibc (patrz \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 (): Wszystkie funkcje powyżej: _XOPEN_SOURCE || /* Glibc od 2.19: */ _DEFAULT_SOURCE || /* Glibc w wersji <= 2.19: */ _SVID_SOURCE .ad b .SH OPIS Funkcje te generują liczby pseudolosowe korzystając z liniowego algorytmu kongruencyjnego i 48\-bitowej arytmetyki liczb całkowitych. .PP Funkcje \fBdrand48\fP() i \fBerand48\fP() zwracają nieujemne zmiennoprzecinkowe wartości podwójnej precyzji równomiernie rozłożone w przedziale [0.0, 1.0). .PP Funkcje \fBlrand48\fP() i \fBnrand48\fP() zwracają nieujemne wartości long integer równomiernie rozłożone w przedziale [0,\ 2^31). .PP Funkcje \fBmrand48\fP() i \fBjrand48\fP() zwracają wartości long integer ze znakiem równomiernie rozłożone w przedziale [\-2^31,\ 2^31). .PP The \fBsrand48\fP(), \fBseed48\fP(), and \fBlcong48\fP() functions are initialization functions, one of which should be called before using \fBdrand48\fP(), \fBlrand48\fP() or \fBmrand48\fP(). The functions \fBerand48\fP(), \fBnrand48\fP(), and \fBjrand48\fP() do not require an initialization function to be called first. .PP Wszystkie te funkcje generują ciąg 48\-bitowych liczb całkowitych \fIXi\fP według liniowego wzoru kongruencyjnego: .PP .in +4n .EX \fBXn+1 = (aXn + c) mod m, gdzie n >= 0\fP .EE .in .PP Parametr \fIm\fP = 2^48, ponieważ korzystamy z 48\-bitowej arytmetyki. Jeśli nie wywołano \fBlcong48\fP(), to parametry \fIa\fP i \fIc\fP przyjmują wartości: .PP .in +4n .EX \fBa = 0x5DEECE66D\fP \fBc = 0xB\fP .EE .in .PP Wartość zwracana przez każdą z funkcji \fBdrand48\fP(), \fBerand48\fP(), \fBlrand48\fP(), \fBnrand48\fP(), \fBmrand48\fP() czy \fBjrand48\fP() jest obliczana przez wygenerowanie następnego 48\-bitowego \fIXi\fP z ciągu, a następnie skopiowanie odpowiedniej liczby bardziej znaczących bitów \fIXi\fP, zależnej od zwracanego typu danych, i przekształcenie ich w zwracaną wartość. .PP The functions \fBdrand48\fP(), \fBlrand48\fP(), and \fBmrand48\fP() store the last 48\-bit \fIXi\fP generated in an internal buffer. The functions \fBerand48\fP(), \fBnrand48\fP(), and \fBjrand48\fP() require the calling program to provide storage for the successive \fIXi\fP values in the array argument \fIxsubi\fP. The functions are initialized by placing the initial value of \fIXi\fP into the array before calling the function for the first time. .PP Funkcja inicjująca \fBsrand48\fP() wpisuje wartość argumentu \fIseedval\fP do \fIXi\fP, ustawiając 32 bardziej znaczące bity. Mniej znaczącym 16 bitom zawsze nadawana jest wartość 0x330E. .PP Funkcja inicjująca \fBseed48\fP() zmienia wartość \fIXi\fP na 48\-bitową wartość podaną w argumencie tablicowym \fIseed16v\fP. Poprzednia wartość \fIXi\fP jest kopiowana do wewnętrznego bufora, a wskaźnik do tego bufora jest zwracany przez funkcję \fBseed48\fP(). .PP The initialization function \fBlcong48\fP() allows the user to specify initial values for \fIXi\fP, \fIa\fP, and \fIc\fP. Array argument elements \fIparam[0\-2]\fP specify \fIXi\fP, \fIparam[3\-5]\fP specify \fIa\fP, and \fIparam[6]\fP specifies \fIc\fP. After \fBlcong48\fP() has been called, a subsequent call to either \fBsrand48\fP() or \fBseed48\fP() will restore the standard values of \fIa\fP and \fIc\fP. .SH ATRYBUTY Informacje o pojęciach używanych w tym rozdziale można znaleźć w podręczniku \fBattributes\fP(7). .ad l .TS allbox; lb lb lb lw21 l lw22. Interfejs Atrybut Wartość T{ \fBdrand48\fP(), \fBerand48\fP(), \fBlrand48\fP(), \fBnrand48\fP(), \fBmrand48\fP(), \fBjrand48\fP(), \fBsrand48\fP(), \fBseed48\fP(), \fBlcong48\fP() T} Bezpieczeństwo wątkowe T{ MT\-Unsafe race:drand48 T} .TE .ad .PP Powyższe funkcje zapisują globalne informacje o stanie generatora liczb losowych, tak więc nie są bezpieczne dla wątków. .SH "ZGODNE Z" POSIX.1\-2001, POSIX.1\-2008, SVr4. .SH "ZOBACZ TAKŻE" \fBrand\fP(3), \fBrandom\fP(3) .SH "O STRONIE" Angielska wersja tej strony pochodzi z wydania 5.10 projektu Linux \fIman\-pages\fP. Opis projektu, informacje dotyczące zgłaszania błędów oraz najnowszą wersję oryginału można znaleźć pod adresem \%https://www.kernel.org/doc/man\-pages/. .SH TŁUMACZENIE Autorami polskiego tłumaczenia niniejszej strony podręcznika są: Adam Byrtek , Andrzej Krzysztofowicz , Robert Luberda i Michał Kułach . Niniejsze tłumaczenie jest wolną dokumentacją. Bliższe informacje o warunkach licencji można uzyskać zapoznając się z .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License w wersji 3 .UE lub nowszej. Nie przyjmuje się ŻADNEJ ODPOWIEDZIALNOŚCI. Błędy w tłumaczeniu strony podręcznika prosimy zgłaszać na adres .MT manpages-pl-list@lists.sourceforge.net .ME .