[Dart-dev] [5047] DART/trunk: Fix the documentation to show the seed is an integer and not

nancy at ucar.edu nancy at ucar.edu
Thu Jun 30 14:20:48 MDT 2011


Revision: 5047
Author:   nancy
Date:     2011-06-30 14:20:48 -0600 (Thu, 30 Jun 2011)
Log Message:
-----------
Fix the documentation to show the seed is an integer and not
a derived type. Add a test when initializing with a seed so
large seeds are avoided; the init code succeeds but you get
a fatal error when subsequenctly retrieving a random number.

Modified Paths:
--------------
    DART/trunk/random_nr/random_nr_mod.f90
    DART/trunk/random_seq/random_seq_mod.html

-------------- next part --------------
Modified: DART/trunk/random_nr/random_nr_mod.f90
===================================================================
--- DART/trunk/random_nr/random_nr_mod.f90	2011-06-30 16:01:06 UTC (rev 5046)
+++ DART/trunk/random_nr/random_nr_mod.f90	2011-06-30 20:20:48 UTC (rev 5047)
@@ -65,6 +65,10 @@
 
 if ( .not. module_initialized ) call initialize_module
 
+if (temp >= ic1) then
+    call error_handler(E_ERR,' ran1', 'Use negative seed or seed smaller than 54000', source, revision, revdate)
+endif
+
 ! Initialize the generator for use with
 ! repeatable sequences
 
@@ -105,7 +109,7 @@
 s%ix3 = mod(ia3*s%ix3 + ic3, m3)
 j = 1 + (97*s%ix3) / m3
 if(j > 97 .or. j < 1) then
-      call error_handler(E_ERR,' ran1', 'Fatal error in random_nr_mod', source, revision, revdate)
+    call error_handler(E_ERR,' ran1', 'Fatal error in random_nr_mod', source, revision, revdate)
 endif
 ran1 = s%r(j)
 s%r(j) = (s%ix1 + s%ix2*rm2)*rm1

Modified: DART/trunk/random_seq/random_seq_mod.html
===================================================================
--- DART/trunk/random_seq/random_seq_mod.html	2011-06-30 16:01:06 UTC (rev 5046)
+++ DART/trunk/random_seq/random_seq_mod.html	2011-06-30 20:20:48 UTC (rev 5047)
@@ -119,7 +119,7 @@
 <em class=call> call init_random_seq(r, <em class=optionalcode>[,&nbsp; seed]</em>) </em>
 <pre>
 type(random_seq_type),           intent(inout) :: <em class=code>r</em>
-type(random_seq_type), optional, intent(in)    :: <em class=optionalcode>seed</em>
+integer,               optional, intent(in)    :: <em class=optionalcode>seed</em>
 </pre>
 </div>
 
@@ -132,6 +132,7 @@
 of independent, reproducible random sequences can be generated by
 having multiple instances of a random_seq_type. A specified integer
 seed, optional, can produce a specific 'random' sequence.
+Seed must be a negative number.
 </P>
 
 <TABLE width=100% border=0 summary="" cellpadding=3>


More information about the Dart-dev mailing list