RANDPERMFULL

버전 4.0.0.1 (2.35 KB) 작성자: Jos (10584)
RANDPERMFULL (N) returns a random derangement (complete permutation) of the integers from 1 to N
다운로드 수: 529
업데이트 날짜: 2019/5/23

라이선스 보기

RANDPERMFULL(N) is a random complete or full permutation of the integers from 1 to N; each integer is randomly assigned to an index position that is different from its value. In other words R = RANDPERMFULL(N) creates a row vector R, such that R(j) ~= j for all j=1:N. This type of permutation is called a derangement.
N should be larger than 1.
Example:
randpermfull(7)
% might be [2 4 5 6 1 7 3], but not [2 1 3 6 4 7 5]
% since 3 cannot be in index position 3.

% Scramble a sentence
Words = {'can', 'you', 'make', 'sense', 'of', 'this', 'scrambled', 'sentence'} ;
R = randpermfull(numel(Words)) ;
disp([sprintf('%s ',Words{R}) '?'])

Reference: http://en.wikipedia.org/wiki/Derangement

인용 양식

Jos (10584) (2024). RANDPERMFULL (https://www.mathworks.com/matlabcentral/fileexchange/30189-randpermfull), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2018a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
4.0.0.1

added image

4.0.0.0

fixed serious error!

3.0.0.0

improvement rejection algorithm

1.0.0.0