I need to sample with replacement from an array A of length n. I want to know how the below two commands are different. If they both give the same result which one is better (in terms of performance etc...)
A[np.random.randint(0, n, n)]
A[np.random.choice(n, n)]
n, whilechoicetook longer for smalln. They probably both use the same random number generator, butchoicehas a longer setup time - after all it accepts more parameters. But the code for both is compiled, which is hard to study.