vendredi 13 février 2015

Strange rand() behaviour in MATLAB

rand() does not seem to generate really random numbers. I have a simple program that returns a 6-digit number by calling :



for i=1:6
r=rand(1,1)
end


so I ran this 4-5 times yesterday. And saved the output. Today I opened MATLAB again and called the same function again 4-5 times. The same numbers were returned.


Why is this happening?


Should I provide a random seed or any other fix?


Thanks for any help!


Aucun commentaire:

Enregistrer un commentaire