I use random.sample
to sample from a very large range depending on the input load. Sometimes the sample itself is very large and since it is a list it occupies a lot of memory.
The application does not necessarily use all the value in the list. It would be great if random.sample
can return a list generator instead of a list itself.
Right now I have a wrapper that divides the large input range into equal sized buckets and use randint
to select a random number from each n / sample_size
buckets.
Aucun commentaire:
Enregistrer un commentaire