Borrar filtros
Borrar filtros

Shuffling elements of an array!!

43 visualizaciones (últimos 30 días)
Abhishek Vashishtha
Abhishek Vashishtha el 23 de Jun. de 2020
Comentada: madhan ravi el 23 de Jun. de 2020
Hi Guys,
I have assigned a vector like this:
lottery = [ 1 , 3 , 4 , 5 , 2 ];
I wanted to shuffle it in randomized array, please let me know how should I do it

Respuesta aceptada

Ashish Azad
Ashish Azad el 23 de Jun. de 2020
Hi Abhishek,
This question is answered earlier too,
meanwhile I will provide with the answer too,
try to use: lottery(randperm(length(lottery)))
randperm(n) will create a randomized vector of length n containing all the values from 1 to n in randomized manner
Please read documentation for further asist
This should work!!
  1 comentario
madhan ravi
madhan ravi el 23 de Jun. de 2020
Providing a complete homework solution is discouraged in this forum.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical 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