How do I randomize unrepeated four integers from 4 to 11

1 view (last 30 days)
randomizer = randi([4 11],1,4) . But it has repeated integers. I do not want it to be repeated.

Answers (1)

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

Categories

Find more on Random Number Generation in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!