changeset 14610:41d7e23f5734

Document rand's seed difference from Matlab * rand.cc (Frand): Mention in docstring that seed is randomly chosen, not always fixed at startup. Give hint on how to obtain Matlab-like behaviour.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Tue, 08 May 2012 23:23:02 -0400
parents 3edba8b5f430
children f2ed09ae8d3f
files src/DLD-FUNCTIONS/rand.cc
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/rand.cc	Tue May 08 18:02:24 2012 -0700
+++ b/src/DLD-FUNCTIONS/rand.cc	Tue May 08 23:23:02 2012 -0400
@@ -358,7 +358,10 @@
 \n\
 By default, the generator is initialized from @code{/dev/urandom} if it is\n\
 available, otherwise from CPU time, wall clock time, and the current\n\
-fraction of a second.\n\
+fraction of a second.  Note that this differs from @sc{Matlab}, which\n\
+always initializes the state to the same state at startup.  To obtain\n\
+behavior comparable to @sc{Matlab}, initialize with a deterministic state\n\
+vector in Octave's startup files (@pxref{Startup Files}).\n\
 \n\
 To compute the pseudo-random sequence, @code{rand} uses the Mersenne\n\
 Twister with a period of @math{2^{19937}-1} (See M. Matsumoto and\n\