Is it possible to modify the numpy.random.choice function in order to make it return the index of the chosen element? Basically, I want to create a list and select elements ran
Here is a simple solution, just choose from the range function.
import numpy as np a = [100,400,100,300,300,200,100,400] I=np.random.choice(np.arange(len(a))) print('index is '+str(I)+' number is '+str(a[I]))