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: Rik
Subject: [Octave-bug-tracker] [bug #54342] rand() produces different results on octave 4.4.0 compared to earlier versions
Date: Fri, 20 Jul 2018 21:03:28 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

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

That case is covered too.  Your example gets caught by the same issue which is
that the state vector returned is of uint32_t.  See below.


octave:2> format long
octave:3> v = rand ("state");
octave:4> class (v)
ans = uint32
octave:5> size (v)
ans =

   625     1

octave:6> v(:) = Inf;
octave:7> v(1:3)
ans =

  4294967295
  4294967295
  4294967295

octave:8> rand ("state", v)
octave:9> rand
ans =    3.215697975380883e-01
octave:10> v = Inf (625,1);
octave:11> v(1:3)
ans =

   Inf
   Inf
   Inf

octave:12> rand ("state", v)
octave:13> rand
ans =    1.464507627751816e-01


So if you actually initialize with a state vector of Inf it does return the
same as a state vector of 0 or -Inf.


    _______________________________________________________

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]