# HG changeset patch # User Markus Meisinger # Date 1595704193 -7200 # Node ID 43c285a2082930e971e8fd4f0a5fa02d16a4c38a # Parent a61b651914d67a81fa8f4d209dd1df3288547495 Update documentation of the random number generator (bug #58800). * rand.cc (Frand): Update documentation for the initialization of the random number generator according to changes in a61b651914d6. diff -r a61b651914d6 -r 43c285a20829 libinterp/corefcn/rand.cc --- a/libinterp/corefcn/rand.cc Thu Jul 23 14:24:46 2020 +0200 +++ b/libinterp/corefcn/rand.cc Sat Jul 25 21:09:53 2020 +0200 @@ -388,12 +388,14 @@ @leq{} 625 for @var{v}. This new state will be a hash based on the value of @var{v}, not @var{v} itself. -By default, the generator is initialized from @code{/dev/urandom} if it is -available, otherwise from CPU time, wall clock time, and the current -fraction of a second. Note that this differs from @sc{matlab}, which -always initializes the state to the same state at startup. To obtain -behavior comparable to @sc{matlab}, initialize with a deterministic state -vector in Octave's startup files (@pxref{Startup Files}). +By default, the generator is initialized by contributing entropy from the +wall clock time, the CPU time, the current fraction of a second, the process +ID and---if available---up to 1024 bits from the C++ random numbers source +@code{random_device}, which might be non-deterministic (implementation +specific). Note that this differs from @sc{matlab}, which always initializes +the state to the same state at startup. To obtain behavior comparable to +@sc{matlab}, initialize with a deterministic state vector in Octave's startup +files (@pxref{Startup Files}). To compute the pseudo-random sequence, @code{rand} uses the Mersenne Twister with a period of @math{2^{19937}-1}