← 返回 google 的题目列表Shuffle a Deck with Random Function
类型:online_judge
You have an integer array representing a deck of cards. Known Python's random.shuffle() function helps you to shuffle the array. Now suppose you need to use random.randint() to implement the Fisher-Yates (Knuth) shuffle algorithm to shuffle the deck. How will you implement it?
Example
Input
1 2 3 4 5 6