Timeline for Assigning mulitple variables to a random item in list. Python
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 14, 2012 at 8:35 | comment | added | Blender | Alex's answer is the correct one. I misread the question... | |
Sep 14, 2012 at 8:32 | comment | added | M830078h | sample() returns ValueError: "sample larger than population" in my case, since I have more variables than elements in the list. | |
Sep 14, 2012 at 8:25 | history | edited | Blender | CC BY-SA 3.0 |
deleted 106 characters in body
|
Sep 14, 2012 at 8:25 | comment | added | kgr |
The problem with sample is that it works "without replacement", i.e. won't work in case when you need more samples than there are elements in the original list. See docs.python.org/library/random.html#random.sample Of course it might work in this particular case (depends on the dataset and the needs), but it's worth noting.
|
|
Sep 14, 2012 at 8:19 | history | answered | Blender | CC BY-SA 3.0 |