I have a list(range(30000))
. I need to randomnly select numbers inside it such that, it takes a certain count of numbers say 'n'
in total at the same time it should take 'k'
number of values between two index positions.
For example:
a = [1,2,3,4,5,,6,7,8......20,21,22......88,89.....30k]
I need to select 5000
numbers in total. 'x'
numbers between 0th index to 100th index
, 'y'
numbers between 100 to 200
etc.
There is no hard rule that it should select 5000
numbers itself. But it should sure lie between 0-100, 100-200
etc.
I saw random.choice
but how to give it a condition
To put the question accurately: I need 50
numbers from 0-100,200-300 etc.
Aucun commentaire:
Enregistrer un commentaire