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 14:31:49 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

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

@Dan: "state" and "seed" are totally different.  "seed" sets the seed for the
older generation of random number generators AND switches Octave to use them
when rand() is called.  It should be avoided.

I haven't looked at this, but I think this could be quite easy to resolve. 
The incoming array to set internal state is now uint32 type.  But check out
the behavior of uint32 for various inputs


octave:8> uint32 (-Inf)
ans = 0
octave:9> uint32 (NaN)
ans = 0
octave:10> uint32 (Inf)
ans = 4294967295


As expected, the constructor for an int maps values which are outside the
range to either the min or the max representable value.  My guess is that
previously Inf was getting mapped to 0.


    _______________________________________________________

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]