mercredi 6 janvier 2021

Generate a list random numbers eliminating the random numbers in another list in Python

I want to generate list of random numbers that are not there in first list. Keeping the size of the list similar as the first one. I have done it R as below . Example:

bb <- sample(1:25,10)

bb

[1] 11 19 23 15 25 12 14 21 10 4

wd <- sample((1:25)[-bb],10)

wd

[1] 13 1 5 9 22 3 2 24 7 16

I want the same thing to be replicated in python . I have tried several ways which was useless.

Kindly help .. Thanks in Adavance




Aucun commentaire:

Enregistrer un commentaire