Skip to content

Reduce failure rate of Arr::shuffle() tests #49769

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

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

valorin
Copy link
Contributor

@valorin valorin commented Jan 22, 2024

This (hopefully) fixes the false positive failure rate on the Arr::shuffle() tests introduced in #49642, as per @TimWolla's comments.

I've increase the data set to 26 characters (A-Z), and changed it to run shuffle() twice in the assertions. This should significantly lower the false positive failure, as the chance of the same shuffle being produced is significantly lower.

I also split the test two into, so they can fail independently.

@taylorotwell taylorotwell merged commit 5125d5f into laravel:master Jan 22, 2024
@TimWolla
Copy link
Contributor

LGTM, shuffling a 26 character string only has a chance of 1/(26!) ~ 4*10^(-26) of returning the original order. This alone is sufficiently unlikely to happen in practice 🙂

@valorin
Copy link
Contributor Author

valorin commented Jan 22, 2024

I thought that'd be the case, but figured I'd go the paranoid route.

Thanks for confirming the fix! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants