Skip to content

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