bugGNU Octave - Bugs: bug #53668, Matlab rand "state"...


bug #53668: Matlab rand "state" vector is 35x1 versus Octave's 625x1

Submitted by:  None
Submitted on:  Mon 16 Apr 2018 09:33:24 AM UTC  
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Wont Fix Assigned to:  None
Originator Name:  Aditya Chakravarty Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  4.2.2
Operating System:  Microsoft Windows

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Mon 16 Apr 2018 03:23:08 PM UTC, comment #1:

It's not wrong, it is just different.

The actual details of the internal state are not important, as long as a programmer can save and restore the state of the random number generators in order to get a consistent random number stream then the function is working well enough.

Consider the example of adding 3 + 5. If you were doing this manually you would keep the numbers in base10, write them down on a piece of paper, and compute the result of 8, also in base10.

A computer, however, would first convert the number 3 to base2 "11" and the number 5 to base2 "101". It would then add to get "1000" and finally convert back to base10 result of 8. The fact that the computer has a completely different representation of the numbers than you or I is unimportant. It is only important that addition actually works correctly, as it indeed does.

Rik <rik5>
Project Administrator
Mon 16 Apr 2018 09:33:24 AM UTC, original submission:

While using the following command:

s = rand('state')

it gives an output matrix of 625 x 1, which in regular Matlab is of only 35 x 1



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-16 rik5 CategoryNone => Octave Function
        Item GroupIncorrect Result => Matlab Compatibility
        StatusNone => Wont Fix
        Open/ClosedOpen => Closed
        SummaryWrong result of command => Matlab rand "state" vector is 35x1 versus Octave's 625x1

    Back to the top

    Powered by Savane 3.4