Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent duplicate questions from being selected #11

Merged
merged 5 commits into from May 11, 2017
Merged

Prevent duplicate questions from being selected #11

merged 5 commits into from May 11, 2017

Conversation

@c-w
Copy link
Contributor

@c-w c-w commented Mar 25, 2017

The random.choice method performs sampling with replacement. This means that the get_ten_random method could return the same question more than once which is not a great user experience.

Using random.sample (part of the standard library since 2.3 so we can for sure assume that it's available), we perform sampling without replacement so that we prevent any possibility of duplicate questions.

c-w added 5 commits Mar 25, 2017
The `random.choice` method performs sampling with replacement. This
means that the `get_ten_random` method could return the same question
more than once which is not a great user experience.
Using `random.sample` (part of the standard library since 2.3 so we can
for sure assume that it's available), we perform sampling without
replacement so that we prevent any possibility of duplicate questions.
@alexgreene alexgreene merged commit 71c713b into alexgreene:master May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants