RAN 3 "14 July 2000" "Version 1.00"

Table of contents


NAME

ran - Single-precision pseudo-random number

SYNOPSIS

Fortran (77, 90, 95, HPF):
f77 [ flags ] file(s) ... -L/usr/local/lib -lgjl
REAL FUNCTION ran()
C (K&R, 89, 99), C++ (98):
cc [ flags ] -I/usr/local/include file(s) ... -L/usr/local/lib -lgjl
Use
#include <gampsi.h>
to get this prototype:
fortran_real ran(void);

NB: The definition of C/C++ data types fortran_ xxx, and the mapping of Fortran external names to C/C++ external names, is handled by the C/C++ header file. That way, the same function or subroutine name can be used in C, C++, and Fortran code, independent of compiler conventions for mangling of external names in these programming languages.

Last code modification: 14-Jul-2000


DESCRIPTION

Generate and return a single-precision pseudo-random number from the interval (0.0, 1.0). The significand of the returned value should have about 29 pseudo-random bits. This is sufficient for most arithmetic systems: in IEEE 754 arithmetic, the fractional part of the single-precision significand has only 23 bits.

The initial generator seed is the same on the first call to this function after every program startup, so that the sequence of pseudo-random number is reproducible. This routine has no provision for the user to alter the initial seed.

The algorithm is based on ``ACM Algorithm 266: Pseudo-Random Numbers'', by M. C. Pike and I. D. Hill, Communications of the ACM, Vol. 8, No. 10, 605--606, October 1965, modified by Hansson, and later used in the book ``Software Manual for the Elementary Functions'', by W. J. Cody, Jr. and W. Waite, Prentice-Hall (1980), ISBN 0-13-822064-6.


SEE ALSO

dran(3).

AUTHORS

The algorithms and code are described in detail in the paper
Algorithm xxx: Quadruple-Precision Gamma(x) and psi(x) Functions for Real Arguments
in ACM Transactions on Mathematical Software, Volume ??, Number ??, Pages ????--???? and ????--????, 2001, by
Nelson H. F. Beebe
Center for Scientific Computing
University of Utah
Department of Mathematics, 110 LCB
155 S 1400 E RM 233
Salt Lake City, UT 84112-0090
Tel: +1 801 581 5254
FAX: +1 801 581 4148
Email: beebe@math.utah.edu, beebe@acm.org, beebe@computer.org
WWW URL: http://www.math.utah.edu/~beebe
and
James S. Ball
University of Utah
Department of Physics
Salt Lake City, UT 84112-0830
USA
Tel: +1 801 581 8397
FAX: +1 801 581 6256
Email: ball@physics.utah.edu
WWW URL: http://www.physics.utah.edu/people/faculty/ball.html