Anonymous user
Permutations/Rank of a permutation: Difference between revisions
Permutations/Rank of a permutation (view source)
Revision as of 04:18, 27 October 2012
, 11 years ago→{{header|Python}}: reverted some modifications, kept unrankers in loops
m (Sp.) |
(→{{header|Python}}: reverted some modifications, kept unrankers in loops) |
||
Line 60:
def unranker1(n, r, pi):
pi[
n = n1
r = rdivn
return pi
Line 81 ⟶ 83:
def unranker2(n, r, pi):
pi[n1], pi[s] = pi[s], pi[n1]
n = n1
r = rmodf
return pi
def ranker2(n, pi, pi1):
pi1[s], pi1[n1] = pi1[n1], pi1[s]
return
def get_random_ranks(permsize, samplesize):
|