필터 지우기
필터 지우기

How do I randomize unrepeated four integers from 4 to 11

조회 수: 1 (최근 30일)
nabilah shuhaimi
nabilah shuhaimi 2021년 12월 2일
답변: Image Analyst 2021년 12월 2일
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