Shuffling a Deck of Card Positions
Marchmont Games ships a card game whose deck is dealt in a fresh order every round. Positions in the deck are numbered from 0, so a deck of n cards is the run of numbers 0 to n-1, and dealing means putting that run into a new order in which every position still appears exactly once. The support team has to be able to replay a reported round exactly, so the order is not left to chance in the usual sense: NumPy's classic global random stream is set from a seed logged with the round, and the deck is rearranged from that stream.
Task: Print the deck order for the round.
Input
One line holding two integers separated by a space: the seed, then n, the number of cards in the deck.
Output
One line holding the n positions in their dealt order, separated by single spaces, each a plain integer. Every number from 0 to n-1 appears exactly once.
Example:
Input:
1 5
Output:
2 1 4 0 3
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in