KnuthShuffle.shuffle()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
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