mercredi 22 juillet 2015

Same initial seed random numbers - matlab

I have a matlab code which has a bunch of random numbers such as: unifrnd(0,1), normrnd(mu,sigma), this sort of functions get repeated over and over again.

Is there any way I can fix the random numbers that are generated? Meaning, I run the code once I get some results, on the second run I get different results (as expected). However, I want to make some experiences and it would be really helpful if I could fix the initial seed so that all randomness would be the same on the two runs.

Thanks, V

edit: Would something like this work: rand('seed', 57)




Aucun commentaire:

Enregistrer un commentaire