Re: strong nonrandom pattern in rand



Peter Perkins wrote:
Petr, it's worth noting that that Tech Solution is a little out of
date -- it
points you to a mex file on MATLAB Central, but in fact the
Mersenne Twister
algorithm is now one of the choices in MATLAB's built-in uniform
generator,
RAND, since several releases ago.

The current versions Matlab contain an internal Mersenne Twister and
the user may use it, if explicitly asks for that. However, without an
explicit request for 'twister' or 'seed', the discussed subtract with
borrow generator is used.

Most users do not know that one can choose between different
generators and rely completely on Matlab defaults. Even the users who
know that there is a choice may think that for simple tasks the
default generator is sufficient and have no reason to investigate the
situation in depth.

Assume, one generates a sequence of 2800 random integers between 0
and 3 from the default generator and splits them into 100 vectors of
length 28. In each of these vectors (a[1], ..., a[28]) consider only
the numbers (a[1], a[16], a[28]). There are 64 possible triples, but
the 10 triples

(0, 0, 1),
(0, 1, 2),
(0, 1, 3),
(0, 2, 0),
(0, 3, 0),
(1, 0, 0),
(1, 0, 1),
(1, 1, 1),
(2, 1, 0),
(3, 1, 0)

never occur. The probability of this event for a good generator is
(54/64)^100 < 4.2e-8. I think, that a generator which fails on the
4.2e-8 level of statistical significance in this simple test using
only 2800 numbers is not acceptable even for simple tasks.
.



Relevant Pages

  • Re: Calculating with big numbers
    ... I am trying to write the Mersenne Twister (random number generator) in ... MATLAB using the official .c sourcecode. ...
    (comp.soft-sys.matlab)
  • Calculating with big numbers
    ... I am trying to write the Mersenne Twister (random number generator) in MATLAB using the official .c sourcecode. ...
    (comp.soft-sys.matlab)
  • Re: Weird problem with fmincon on 2008b
    ... I am simulating a data generating process hence the use of randn. ... Everything goes well until I open up a second instance of Matlab 2008b (in ... Start one session of MATLAB and perform some operations involving RAND, ... pseudorandom number generator in the two sessions are not in the same state. ...
    (comp.soft-sys.matlab)
  • Re: Matlabs random number generator is suspicious... what to do?
    ... Are they ways that I can make Matlab's random number generator better? ... The cause of this as of yet unknown problem has to ... the default generator in MATLAB. ... different scaling method might make all the difference. ...
    (comp.soft-sys.matlab)
  • Re: randn & state
    ... sets have the same analysis code. ... I thought that Matlab uses random seeds by default. ... Setting the generator to the same fixed state ... states leads to unique computations, however, it does not improve any ...
    (comp.soft-sys.matlab)