KnuthShuffle   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 6
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A shuffle() 0 5 2
1
from random import randint
2
3
from pyalgs.algorithms.commons.util import exchange
4
5
6
class KnuthShuffle(object):
7
    @staticmethod
8
    def shuffle(a):
9
        for i in range(1, len(a)):
10
            r = randint(0, i)
11
            exchange(a, r, i)
12