Bug 32879 - Document algorithm used for random generator
Summary: Document algorithm used for random generator
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: documentation
Depends on:
Blocks:
 
Reported: 2007-07-24 15:08 UTC by Tobias Burnus
Modified: 2007-07-29 10:50 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-07-24 16:30:19


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2007-07-24 15:08:46 UTC
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)
Comment 1 Janne Blomqvist 2007-07-24 16:30:19 UTC
Confirmed, thought the documentation for RANDOM_NUMBER already mentions that it uses KISS, so this applies only to the legacy intrinsics.
Comment 2 Tobias Burnus 2007-07-24 16:44:16 UTC
> 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
Comment 3 patchapp@dberlin.org 2007-07-28 09:45:13 UTC
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
Comment 4 Daniel Franke 2007-07-29 10:01:41 UTC
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

Comment 5 Daniel Franke 2007-07-29 10:49:23 UTC
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

Comment 6 Daniel Franke 2007-07-29 10:50:22 UTC
Documented in 4.2 and trunk. Closing.