Filter löschen
Filter löschen

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

4 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

Fangjun Jiang
Fangjun Jiang am 4 Okt. 2021
Bearbeitet: Fangjun Jiang am 4 Okt. 2021
a=zeros(1000,25);
a(:)=randperm(1000000, numel(a));

Weitere Antworten (0)

Kategorien

Mehr zu Random Number Generation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by