shuffle.m

来自「vigenere密码解密的matlab实现」· M 代码 · 共 19 行

M
19
字号
function shval = shuffle(cvals,k,p)% This function hides and shuffles the cards whose values are passed% in the vector cvals. The hiding operation takes place by taking % cvals and raising its elements to the kth power mod p% Shuffling is a random permutationcln=length(cvals);hvals=zeros(cln,1);for j=1:cln,   hvals(j)=powermod(cvals(j),k,p);end;% now to shuffle the cardsind=randperm(cln);shval=hvals(ind);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?