[issue33114] random.sample() behavior is unexpected/unclear from docs

2018-03-26 Thread Scott Eilerman
Scott Eilerman added the comment: Raymond, Tim, thanks for your replies so far. I understand (and for the most part, agree with) your points about not being able to list every behavior, and not wanting to cause uncertainty in users. However, let me argue my case one more time, and if you

[issue33114] random.sample() behavior is unexpected/unclear from docs

2018-03-21 Thread Scott Eilerman
Scott Eilerman added the comment: Sorry, there's a typo in that example. It should look like: random.seed(fixed_seed) random.sample(choices, n)[-1] Then, later, I want the next draw, so I did: random.seed(fixed_seed) random.sample(choices, n+

[issue33114] random.sample() behavior is unexpected/unclear from docs

2018-03-21 Thread Scott Eilerman
Scott Eilerman added the comment: To clarify the use case where this behavior was problematic for me, I wanted to get the nth random draw from a given distribution, so I used something like: random.seed(fixed_seed) random.sample(choices, n)[-1] Then, later, I want the next draw, so I did

[issue33114] random.sample() behavior is unexpected/unclear from docs

2018-03-21 Thread Scott Eilerman
Scott Eilerman added the comment: Something along the lines of: "For a fixed seed, random.sample(population, k) is not guaranteed to return the same samples for different values of k." -- ___ Python tracker <https://bugs.python.o

[issue33114] random.sample() behavior is unexpected/unclear from docs

2018-03-21 Thread Scott Eilerman
New submission from Scott Eilerman : I ran into a "bug" when using random.sample() in which I got some results I didn't expect. After digging a little more, this is either a side effect of the optimization that's made when k > 5, or I am using the function in a way t