How do I fill a 1000*25 length vector with random, non-repetitive numbers from 1 to 1000000?

조회 수: 1 (최근 30일)
I tried numerous ways of doing the above but I keep getting compatibility issues since randperm(1000000) returns a vector of length 1000000 and my created vector is just 1000*25.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2021년 10월 4일
편집: Fangjun Jiang 2021년 10월 4일
a=zeros(1000,25);
a(:)=randperm(1000000, numel(a));

추가 답변 (0개)

카테고리

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