필터 지우기
필터 지우기

randperm(n,k) in R2011a

조회 수: 3 (최근 30일)
Andreas Lobinger
Andreas Lobinger 2016년 8월 17일
답변: Thorsten 2016년 8월 17일
I try to port some new (R2015b) code using randperm(n,k) back to pre-R2011a. And initially i thought i could use r = randperm(10); r(1:4); as replacement for randperm(10,4) but then
>> rng(11313)
>> randperm(10,10)
ans =
10 1 7 8 5 6 3 9 4 2
>> rng(11313)
>> randperm(10)
ans =
9 1 10 6 7 3 8 2 5 4
i cannot see a structure, how randperm operates.

답변 (1개)

Thorsten
Thorsten 2016년 8월 17일
We cannot have a look into the randperm function. So if it is essential for you program to produce the same sequence of random numbers, you have to use
r = randperm(10); r(1:4);
in your program, also in the R2015b version.

카테고리

Help CenterFile Exchange에서 Sparse Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by