how to fix random seed in inbuilt ga in matlab

1 vue (au cours des 30 derniers jours)
Rajasekhar Kadambur
Rajasekhar Kadambur le 24 Juil 2013
I am trying to use inbuilt ga to use some objective. for running the results varies, so i would like to get the same results that i got last time. for this random seed is used to fix random number generator so that the results are same for a seed value. please help me in this

Réponses (1)

kjetil87
kjetil87 le 24 Juil 2013
Modifié(e) : kjetil87 le 24 Juil 2013
Create a seed and use that.
init=100;
mySeed=RandStream.create('mt19937ar','seed',init);
now you can either use
numb=rand(mySeed,[m,n]); % m, n desired size
or you can set it as default by:
RandStream.setDefaultStream(mySeed); % for newer versions use setGlobalStream

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by