CM FORTRAN LIBRARIES REFERENCE MANUAL Version 2.1, January 1994 Copyright (c) 1994 Thinking Machines Corporation. CHAPTER 3: RANDOM NUMBERS ************************** Three subroutines serve to fill a CM array with pseudo random numbers: CALL CMF_RANDOMIZE( SEED ) CALL CMF_RANDOM( DEST, LIMIT ) CALL CMF_RANDOM_LONG_S_INTEGER( DEST, LIMIT ) CMF_RANDOMIZE sets a seed for the random number generator used by the other two subroutines. CMF_RANDOM and CMF_RANDOM_LONG_S_INTEGER use the initialized random number generator to store a pseudo random number in each element of the DEST array. For CMF_RANDOM, the DEST array can be of type INTEGER*4, INTEGER*8, REAL, DOUBLE PRECISION, COMPLEX, or DOUBLE COMPLEX. For CMF_RANDOM_LONG_INTEGER, the DEST array must be of type INTEGER*8. LIMIT is of type INTEGER*4 for CMF_RANDOM and INTEGER*8 for CMF_RANDOM_LONG_S_INTEGER. The LIMIT argument should always be specified as 1.0 for floating-point values. For integers, the argument serves as the exclusive upper bound of the values generated. If you do not want to set a limit for integer values, specify the LIMIT argument as 0. The random number generator algorithm used by these routines is Wolfram's Rule 30 Cellular Automaton, described in Stephen Wolfram, ``Random Sequence Generation by Cellular Automata," Advances in Applied Mathematics 7, pp. 123-69 (1986). This paper may be more readily available as a reprint in Stephen Wolfram, Theory and Application of Cellular Automata, World Scientific (1986). The cellular automaton is run on a finite string of bits, i=0,...,N-1, with periodic boundary conditions (so that site N is equivalent to site 0). In the CM implementation N = 59. o For integer values, CMF_RANDOM generates the random numbers by running the automaton for 32 generations. (If DEST is of type INTEGER*8, only 32 of the 64 bits are filled.) CMF_RANDOM_LONG_S_INTEGER runs the automaton for 64 generations. o For real, double-precision real, complex, or double-precision complex values, the random numbers are generated by running the automaton for s generations (where s is the mantissa length), and setting the exponent bits and sign bit so that the values are uniformly distributed between 2.0 and 1.0. Then 1.0 is subtracted from the results to yield numbers that are uniformly distributed between 0.0 and 1.0. 3.1 LANGUAGE COMPARISON ------------------------ No comparable language feature. Man Pages --------- To view UNIX-style man pages for these subroutines, on a CM-5 type man on a CM-2 type cmman or from within commands-only Prism type m where is one of CMF_RANDOMIZE CMF_RANDOM CMF_RANDOM_LONG_S_INTEGER ***************************************************************** The information in this document is subject to change without notice and should not be construed as a commitment by Think- ing Machines Corporation. Thinking Machines reserves the right to make changes to any product described herein. Although the information in this document has been reviewed and is believed to be reliable, Thinking Machines Corporation assumes no liability for errors in this document. Thinking Machines does not assume any liability arising from the application or use of any information or product described herein. ***************************************************************** Connection Machine (r) is a registered trademark of Thinking Machines Corporation. CM, CM-2, CM-200, CM-5, CM-5 Scale 3, and DataVault are trademarks of Thinking Machines Corporation. CMOST, CMAX, and Prism are trademarks of Thinking Machines Corporation. C* (r) is a registered trademark of Thinking Machines Corporation. Paris and CM Fortran are trademarks of Thinking Machines Corporation. CMMD, CMSSL, and CMX11 are trademarks of Thinking Machines Corporation. CMview is a trademark of Thinking Machines Corporation. Scalable Computing (SC) is a trademark of Thinking Machines Corporation. Scalable Disk Array (SDA) is a trademark of Thinking Machines Corporation. Thinking Machines (r) is a registered trademark of Thinking Machines Corporation. SPARC and SPARCstation are trademarks of SPARC International, Inc. Sun, Sun-4, and Sun Workstation are trademarks of Sun Microsystems, Inc. UNIX is a trademark of UNIX System Laboratories, Inc. Copyright (c) 1994 by Thinking Machines Corporation. All rights reserved. This file contains documentation produced by Thinking Machines Corporation. Unauthorized duplication of this documentation is prohibited. Thinking Machines Corporation 245 First Street Cambridge, Massachusetts 02142-1264 (617) 234-1000