How do I create a set of random numbers with a given set of numbers? Using randi command.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Thanakorn Runglerdkriangkrai
el 22 de Sept. de 2020
Comentada: Thanakorn Runglerdkriangkrai
el 22 de Sept. de 2020
This is my code,
a = [8 5 2 6 9 3 1 4 0 7];
randi(imax,n);
When I run it, there is an error, "Unrecognized function or variable 'imax' ". So I am wondering what is my mistake here?
0 comentarios
Respuesta aceptada
madhan ravi
el 22 de Sept. de 2020
Editada: madhan ravi
el 22 de Sept. de 2020
a(randi(numel(a), 1, numel(a))) % for unique numbers use randperm()
Más respuestas (0)
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!