MCPcopy Create free account
hub / github.com/ActiveState/code / shuffle

Function shuffle

recipes/Python/578466_Shuffle/recipe-578466.py:4–10  ·  view source on GitHub ↗
(cards)

Source from the content-addressed store, hash-verified

2import unittest
3
4def shuffle(cards):
5 max = len(cards)-1
6 while max != 0:
7 r = random.randint(0, max)
8 cards[r], cards[max] = cards[max], cards[r]
9 max = max - 1
10 return cards
11
12class TestCase(unittest.TestCase):
13 def setUp(self):

Callers 9

test_elementsMethod · 0.70
recipe-437116.pyFile · 0.50
check_transitionsMethod · 0.50
recipe-576930.pyFile · 0.50
irandomizeFunction · 0.50
FracDownFunction · 0.50
playMethod · 0.50
FracDownFunction · 0.50
k_fold_cross_validationFunction · 0.50

Calls

no outgoing calls

Tested by 1

test_elementsMethod · 0.56