octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #54342] rand() produces different results on o


From: Ian McCallion
Subject: [Octave-bug-tracker] [bug #54342] rand() produces different results on octave 4.4.0 compared to earlier versions
Date: Sun, 22 Jul 2018 15:22:14 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36

Follow-up Comment #16, bug #54342 (project octave):

Hi Rik,

Yes indeed, matlab compatibility is a more worthwhile discussion topic than
earlier Octave release compatibility. Compatibility can take other forms than
imitating Matlab though. E.g. To enable cooperation with a matlab-using
co-worker on my project we mimic Octave 4.2.2 semantics everywhere using:

    if (isoctave())
        %% Mimic octave 4.2.2 when using Octave 4.4.0
        if state == Inf
            rand('state',0);
        else
            rand('state',floor(state));
        end
        rvec=rand(size(abin));
    else
        %% Mimic Octave 4.2.2 when using matlab
        mt=octave_twister_seed(state);
        ss=RandStream('mt19937ar');
        ss.set('State', mt);
        rvec=ss.rand(size(abin));
    end


I can probably provide the .m source for octave_twister_seed(state) for you if
you think that gets you any further forwards, though as it is not my own work
I would need to check out of courtesy first.

Ian

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?54342>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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