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 createRandomZombie function for DNA uniqueness #47

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

xyz899
Copy link

@xyz899 xyz899 commented Aug 7, 2023

Description

This pull request addresses the issue of duplicate DNA in the createRandomZombie function. When generating a random DNA for a new zombie, I noticed that the initial approach could lead to duplicate DNA values among the zombies. To ensure DNA uniqueness, I implemented a check that verifies if the generated DNA already exists in the zombies array.

Changes Made

  • Added a DNA uniqueness check in the createRandomZombie function to prevent duplicates.
  • If the initial randDna is not unique, re-generate a new randDna until uniqueness is achieved.

Testing

I have thoroughly tested the modified function with various names and verified that each new zombie created has a unique DNA.

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.

1 participant