rng usability missing seed functionality
Mostrar comentarios más antiguos
Folks,
It looks like using "seeds" is being considered "old fashioned" in Matlab 2022b, and there is a warning about it suggesting it will be obsolete soon. We are encouraged to use "rng" function instead, which has only one way to set the seed by using the "default" option. The problem I have with this is that my usage model is such that I want to change seeds and lock them for subsequent runs within the same program instance. I don't see how this is possibly unless I am able to save more than one "default" position. Is there another way to achieve my desired result using a function not targetted for obsolesence?
Thanks,
Kris
7 comentarios
Rik
el 27 de En. de 2023
What do you mean by locking? You can specify a seed yourself if you want, the example in the documentation for rng shows you how you can do that. You seem to be confused by the syntax rng('default'). It will set the seed to 0 and the generator to twister, but you can set other parameters if you wish.
Tahariet Sharon
el 8 de Mzo. de 2023
I am getting this error when using:
>> rng('default')
Error using rand
State must be a double scalar or the output of RAND('twister').
Rik
el 8 de Mzo. de 2023
@Tahariet Sharon which Matlab release are you using?
Tahariet Sharon
el 8 de Mzo. de 2023
2019b
Stephen23
el 8 de Mzo. de 2023
@Tahariet Sharon: please show us the output of this command:
which rng -all
Tahariet Sharon
el 19 de Jun. de 2023
/Applications/MATLAB_R2022b.app/toolbox/matlab/randfun/rng.m
Rik
el 20 de Jun. de 2023
That is extremely strange. You're using R2019b, but the which command shows that the files used belongs to R2022b.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!