help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bad random numbers


From: Mike Miller
Subject: Re: bad random numbers
Date: Tue, 13 Jul 1999 16:56:23 -0500 (CDT)

On Tue, 13 Jul 1999, heberf wrote:

> I don't think this needs to be a concern.  Consider the following 

It is a huge problem.  It doesn't seem to happen when running octave
interactively.  It happens when running from a script or unix command
line.

Mike


> octave:1> z = zeros(500,1);
> octave:2> Y = X = zeros(100,3);
> octave:3> for m = 1:500
> > for k = 1:1000
> > Y(k,:) = rand(1,3);
> > X(k,:) = rand(1,3);
> > endfor
> > M = cov(X,Y);
> > z(m) = M(1,1);
> > endfor
> 
> This takes a while but if you look at z you will see that it takes on 
> positive 
> and negative values is centered around zero as it should be.  So the first 
> elements of two successive rand(1,3) operations are uncorrelated.
> 
> Heber Farnsworth
> 
> Gerald Jansen wrote: 
> > "John W. Eaton" wrote:
> > > On 13-Jul-1999, Mike Miller <address@hidden> wrote:
> > > | Note that the resulting matrix always had a very small number in the
> > > | 1,1 cell.  The value in that cell ranged from .003 to .017 ...
> > >
> > > The initial seeds for rand are computed from time().  Not random
> > > itself, but at least it should be different each time you run Octave.
> > 
> > Perhaps the first random number should be discarded if the seed computed
> > from time() leads to patterns, like those observed by Mike, on some
> > systems.
> > 
> > -- 
> > Gerald Jansen
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > Octave is freely available under the terms of the GNU GPL.  To ensure
> > that development continues, see www.che.wisc.edu/octave/giftform.html
> > Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
> > ---------------------------------------------------------------------
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.  To ensure
> that development continues, see www.che.wisc.edu/octave/giftform.html
> Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
> ---------------------------------------------------------------------
> 



---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.  To ensure
that development continues, see www.che.wisc.edu/octave/giftform.html
Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
---------------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]