79300740

Date: 2024-12-22 09:31:04
Score: 0.5
Natty:
Report link

This operation could be sped up using Numba:

import numpy as np
import numba as nb

@nb.jit(nopython=True, fastmath=True)
def draw_random_samples(len_deck, n_simulations, n_cards):

    deck_indices = np.arange(len_deck)
    simulations = [np.random.choice(deck_indices, n_cards, replace=False) 
                   for i in range(n_simulations)]
    
    return simulations
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Mark