gfortran has: irand() - g77 rand() - g77 random_number() - Fortran 90 The algorithm used is different. Expected: - State something about the used algorithm - Point rand() users to random_number() as this algorithm is seemingly better. (or make at least clear(er) that the algorithms are different) Cf. http://gcc.gnu.org/ml/fortran/2007-07/msg00454.html > There are two random number generators in gfortran, one is a simple modulo > generator that is there for compatibility with g77, this is what you get when > you call RAND(). > > The other is the RNG that implements the Fortran 90 RANDOM_NUMBER intrinsic. > [...] George Marsaglia's KISS (Keep It Simple Stupid)
Confirmed, thought the documentation for RANDOM_NUMBER already mentions that it uses KISS, so this applies only to the legacy intrinsics.
> Confirmed, thought the documentation for RANDOM_NUMBER already mentions that it > uses KISS, so this applies only to the legacy intrinsics. Is KISS clear enough? If yes then it indeed only applies to RAND(). http://gcc.gnu.org/onlinedocs/gfortran/IRAND.html http://gcc.gnu.org/onlinedocs/gfortran/RAND.html http://gcc.gnu.org/onlinedocs/gfortran/RANDOM_005fNUMBER.html
Subject: Bug number PR32879 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-07/msg02029.html
Subject: Bug 32879 Author: dfranke Date: Sun Jul 29 10:01:27 2007 New Revision: 127037 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127037 Log: 2007-07-29 Daniel Franke <franke.daniel@gmail.com> PR fortran/32879 * intrinsic.texi (IRAND, RAND, RANDOM_NUMBER): Document algorithm used for random number generator. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/intrinsic.texi
Subject: Bug 32879 Author: dfranke Date: Sun Jul 29 10:49:11 2007 New Revision: 127042 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127042 Log: 2007-07-29 Daniel Franke <franke.daniel@gmail.com> Backport from trunk: 2007-07-29 Daniel Franke <franke.daniel@gmail.com> * invoke.texi: Removed -w from option summary. 2007-07-29 Daniel Franke <franke.daniel@gmail.com> PR fortran/32879 * intrinsic.texi (IRAND, RAND, RANDOM_NUMBER): Document algorithm used for random number generator. 2007-07-13 Daniel Franke <franke.daniel@gmail.com> * invoke.texi: Unified upper- and lower-case in menus. (-w, -W): Removed, documented by gcc. * intrinsic.texi: Unified Class-section entries, added subroutine/function warning where appropiate. 2007-05-01 Daniel Franke <franke.daniel@gmail.com> * intrinsic.texi (MVBITS): Changed class to elemental subroutine. (RANDOM_NUMBER): Changed class to subroutine. (HUGE, TINY): Changed class to inquiry function. Modified: branches/gcc-4_2-branch/gcc/fortran/ChangeLog branches/gcc-4_2-branch/gcc/fortran/intrinsic.texi branches/gcc-4_2-branch/gcc/fortran/invoke.texi
Documented in 4.2 and trunk. Closing.