help-octave
[Top][All Lists]
Advanced

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

Re: Generate same rand sequence in Octave, Matlab


From: Ben Abbott
Subject: Re: Generate same rand sequence in Octave, Matlab
Date: Thu, 08 Dec 2011 18:51:50 -0500

On Dec 8, 2011, at 6:17 PM, Jordi GutiƩrrez Hermoso wrote:

> On 8 December 2011 14:39, Steve Thompson <address@hidden> wrote:
>> Hi list,
>> 
>> I'm trying to figure out if it is possible to get the same rand (and randn)
>> sequence in Matlab (2007) and Octave.
>> 
>> In Matlab (7.4.0.287 (R2007a)) I get:
>>>> rand('state', 0)
>>>> rand
>> ans = 0.9501
>> 
>> In Octave (3.2.4) I get:
>> octave:1> rand('state', 0)
>> octave:2> rand
>> ans =  0.84442
>> 
>> It is possible to get the same sequence?
> 
> Unlkely. We don't use the same implementation, and I would expect the
> details of their implementation are hidden, so there's no way we could
> even match it.
> 
> If you are able to find a description of the details (if possible,
> reading the source) and are able to describe those details to us
> WITHOUT showing us the source (i.e. clean room reverse engineering,
> just give us a spec to implement) we might be able to patch Octave to
> do this.
> 
> - Jordi G. H.

There's no chance to peak at the code. Both rand and randn are built-ins for 
Matlab. 

        which rand
        built-in (/Applications/MATLAB_R2011b.app/toolbox/matlab/randfun/rand)
        which randn
        built-in (/Applications/MATLAB_R2011b.app/toolbox/matlab/randfun/randn)

Ben



reply via email to

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