MATLAB: How to create a matrix with a randomized permutation of integers permutationssliding puzzle Alternatively: What is the matrix equivalent of randperm(n,k)? I can't figure out a simple way to do this. Best Answer Can you accomplish what you want by simply reshaping a random vector into a matrix?reshape(randperm(16,16),[4,4])ans = 4 12 11 15 7 5 13 9 14 8 2 1 6 10 3 16 Related SolutionsMATLAB: How to sort a matrix in a random order E.g.,>> x = reshape(1:24,4,6)x = 1 5 9 13 17 21 2 6 10 14 18 22 3 7 11 15 19 23 4 8 12 16 20 24>> x(:) = x(randperm(numel(x)))x = 7 12 3 19 16 23 20 24 10 11 1 17 21 14 8 5 13 18 6 22 15 4 2 9 MATLAB: Create a 20×24 matrix with each individual column with random integers without duplicate iwant = zeros(20,24) ; for i = 1:24 iwant(:,i) = randperm(20,20);end Related QuestionAlphabetical random permutationHow to reshape a 2D to 3D matrix without using loops (reshape) and keeping a particular order of the elements// Wrong arragement of elemts after using “reshape”Rearrange any matrix Randomly with a specific sequenceHow to generate uniformly distributed random integersHow can i rotate an N-dimensional matrix
Best Answer