dimanche 26 septembre 2021

Efficient way to fill a 1D numpy array of variable length with random numbers in different ranges

I need to fill a length n 1D numpy array with random numbers from the ranges [1,2,...,n], [2,3,...,n], [3,4,...,n], ..., [n-1,n] and [n] respectively. I am looking for a vectorize solution to this problem. Thanks very much in advance.




Aucun commentaire:

Enregistrer un commentaire