Create a set of 165 random numbers

조회 수: 1 (최근 30일)
Johanna Popp
Johanna Popp 2021년 8월 9일
편집: Johanna Popp 2021년 8월 9일
Hi all,
I would like to create a set of 165 random numbers within the range of 1:557 so that the radom numbers are distributed equally in groups of 10 numbers. Here is an example, to make my problem more clear:
1:10 --> 3 random numbers (say 3,6,7)
11:20 --> 3 random numbers (say 11,15,18)
21:30 --> 3 random number (say 26,27,28)
.
.
541:550 --> 3 random numbers (say 542,544, 547)
I hope my problem is clear...
All help is appreciated, thanks!

채택된 답변

KSSV
KSSV 2021년 8월 9일
Read about randsample, randperm.
  댓글 수: 1
Johanna Popp
Johanna Popp 2021년 8월 9일
편집: Johanna Popp 2021년 8월 9일
Thank you, I think I got it:
group = (i*10+1):((i*10)+10);
y = randsample(group,3,false)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by