Randperm same sequence each time you run the code

7 visualizaciones (últimos 30 días)
Stef
Stef el 26 de Mayo de 2018
Editada: Ameer Hamza el 26 de Mayo de 2018
Is there a possibility to have each time the same random permutation when you run the code to make results comparable?
randperm(length(X))
I want to have the random numbers in the same order everytime the code is run.

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 26 de Mayo de 2018
Editada: Ameer Hamza el 26 de Mayo de 2018
See the random number generator with the same number. For example, add this line before running randperm()
rng(5); % you can use any number instead of 5

Más respuestas (0)

Categorías

Más información sobre Random Number Generation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by