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

fix(shuffle): Ensure shuffle function does not modify original array #29

Conversation

kangju2000
Copy link
Contributor

[AS-IS]

The previous implementation of the shuffle function modified the original array, which is unintended behavior.

[TO-BE]

the function now duplicates the array internally before shuffling. This ensures the original array remains unaffected.

Changes

  • Modify the shuffle function to copy the array before shuffling
  • Add a test case to validate the preservation of the original array

Copy link

vercel bot commented Jun 7, 2024

@kangju2000 is attempting to deploy a commit to the Toss Team on Vercel.

A member of the Team first needs to authorize it.

src/array/shuffle.ts Outdated Show resolved Hide resolved
src/array/shuffle.ts Outdated Show resolved Hide resolved
src/array/shuffle.ts Outdated Show resolved Hide resolved
src/array/shuffle.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@raon0211 raon0211 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was unintended behavior. Thanks for pointing this out!

@raon0211 raon0211 merged commit 958de0f into toss:main Jun 8, 2024
5 of 6 checks passed
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.

2 participants