Borrar filtros
Borrar filtros

How do I randomize unrepeated four integers from 4 to 11

1 visualización (últimos 30 días)
nabilah shuhaimi
nabilah shuhaimi el 2 de Dic. de 2021
Respondida: Image Analyst el 2 de Dic. de 2021
randomizer = randi([4 11],1,4) . But it has repeated integers. I do not want it to be repeated.

Respuestas (1)

Image Analyst
Image Analyst el 2 de Dic. de 2021
Use randperm():
randomizer = 3 + randperm(11-4+1,4)
randomizer = 1×4
11 6 9 8

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