As an example, say we want a random 13-card hand from a 52-card deck. We can randomly shuffle all 52 cards and extract the first 13:
import numpy as np
cards = np.arange(52)
rng = np.random.default_rng()
rng.shuffle(cards)
hand = cards[:13]
Is there a faster way given that we only need a prefix of the shuffled result? (Including when the array sizes are larger.)