How do I randomize unrepeated four integers from 4 to 11

1 次查看(过去 30 天)
randomizer = randi([4 11],1,4) . But it has repeated integers. I do not want it to be repeated.

回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Random Number Generation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by