Is MATLAB's Randomization Function Affected by Appending Numbers to Student IDs?

  • Thread starter Thread starter emergentecon
  • Start date Start date
  • Tags Tags
    Matlab
AI Thread Summary
The discussion centers on the issue of MATLAB's randomization function returning the same result despite changing the appended numbers to student IDs. Users report that using the command `rand("state",student_number0917)` does not yield different outputs across various assignments. It is noted that this behavior may be due to changes in MATLAB's random number generation methods in newer versions, suggesting that the "rng" command should be used instead of "rand('state',...)" for proper functionality. One user confirms they experienced the same results and plans to consult their professor about the discrepancy. The conversation highlights the importance of adapting to updated MATLAB syntax for random number generation.
emergentecon
Messages
57
Reaction score
0

Homework Statement



Enter the following two commands, and copy and paste the output as your answer
> rand("state",student_number0917);
> rand(1)
where student_number0917 is your student number with "0917" at the end and with "-" removed.
For example, if your student number is 123-456-7, you would enter
> rand("state",12345670917);
> rand(1)


The problem is, we need to do this for each new assignment, and for each new assignment, we append a new number: 0917 (in this instance), then 0913, 0920, 0911 etc.

However, I always get the same result, no matter what number I append?
Am I missing something?

Homework Equations



> rand("state",1234567?);
> rand(1)

The Attempt at a Solution



>> clc; clear;
>> rand('state',312754190917)
>> rand(1)

ans =

0.662733934182293

OR


>> clc; clear;
>> rand('state',312754190913)
>> rand(1)

ans =

0.662733934182293
 
Physics news on Phys.org
Yeah, that is the exact version I am using . . . cool, will look into it!
I have emailed my Prof. (included your post) :)

Thanks!
 
I picked up this problem from the Schaum's series book titled "College Mathematics" by Ayres/Schmidt. It is a solved problem in the book. But what surprised me was that the solution to this problem was given in one line without any explanation. I could, therefore, not understand how the given one-line solution was reached. The one-line solution in the book says: The equation is ##x \cos{\omega} +y \sin{\omega} - 5 = 0##, ##\omega## being the parameter. From my side, the only thing I could...
Essentially I just have this problem that I'm stuck on, on a sheet about complex numbers: Show that, for ##|r|<1,## $$1+r\cos(x)+r^2\cos(2x)+r^3\cos(3x)...=\frac{1-r\cos(x)}{1-2r\cos(x)+r^2}$$ My first thought was to express it as a geometric series, where the real part of the sum of the series would be the series you see above: $$1+re^{ix}+r^2e^{2ix}+r^3e^{3ix}...$$ The sum of this series is just: $$\frac{(re^{ix})^n-1}{re^{ix} - 1}$$ I'm having some trouble trying to figure out what to...

Similar threads

Replies
4
Views
4K
Replies
1
Views
9K
Replies
5
Views
3K
Replies
10
Views
5K
Replies
1
Views
7K
Replies
1
Views
3K
Back
Top