shuffle - Shuffling algorithm which is commutative on element deletion? -


for application i'm writing (in functional language), i'd implement deterministic shuffling algorithm given same seed, return same shuffled array element @ position x removed had element had not been in array in first place. example: if shuffle([1,2,3,4,5], seed) = [4,2,3,1,5] shuffle([1,3,4,5], seed) should return [4,3,1,5]. before try reinvent wheel, must ask: such algorithm exist? (also wondering if property has name). input.

if shuffle yields either original list or list reversed (depending on seed), have property describe. else, , not of sublists, when matched corresponding shuffling, have elements move same way. example, consider shuffle([1,2,3]). in table below, each column different shuffle; each case, 1 of 3 sub-lists has shuffle moves elements differently other two.

shuffle([1,2,3])  = [1,3,2]  [2,1,3]  [2,3,1]  [3,1,2] shuffle([1,2])    = [1,2]    [2,1]*   [2,1]    [1,2]* shuffle([1,3])    = [1,3]    [1,3]    [3,1]    [3,1] shuffle([2,3])    = [3,2]*   [2,3]    [2,3]*   [3,2] 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -