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

Passed array gets sorted in place #98

Closed
jjnp opened this issue Aug 13, 2018 · 1 comment · Fixed by #99
Closed

Passed array gets sorted in place #98

jjnp opened this issue Aug 13, 2018 · 1 comment · Fixed by #99

Comments

@jjnp
Copy link

jjnp commented Aug 13, 2018

I just noticed that the array with the values passed gets sorted in place, and that this is undocumented behaviour, which can cause problems if you don't expect the passed array to be sorted afterwards.
Simple fix is to pass it via, so that a copy is created beforehand:
percentile(50, myArray.slice(0))
I'll submit a PR for it myself if I get around to it...

@d4rkr00t
Copy link
Owner

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 a pull request may close this issue.

2 participants