Replacing numpy function written in loops by JS code

Description of the problem:
Simply, how can I replace this function written in loop/SelectedRows to be acceptable in online deployment:

$np.random.choice(a, size = b, replace = False)