DEV Community

loading...
Cover image for How to create a password generator using react

How to create a password generator using react

Aman Singh
Frontend Devloper
・1 min read

React_SS

Link : https://password-generator5.netlify.app/

GitHub logo Aman2221 / React-Password-Generator

Password Generator built using react

React-Password-Generator

Password Generator built using react https://password-generator5.netlify.app/




Discussion (8)

Collapse
inhuofficial profile image
InHuOfficial • Edited

There is an error in your code:

const characterIndex = Math.round(Math.random() * CharacterListLength);

It should be Math.floor otherwise you may end up with an index the same as the CharacterListLength and that would be an invalid index.

Also it is a good practice to share a jsfiddle codepen etc so people can play with your code.

Either way, it looks nice! ❤

Collapse
yoursunny profile image
Junxiao Shi

Math.random() is not cryptographically secure and must not be used to generate passwords.
Instead, use Crypto.getRandomValues().

Collapse
aman2221 profile image
Aman Singh Author • Edited

Thank you so much bro
now it's working properly

Collapse
sloan profile image
Sloan

Hi there, we encourage authors to share their entire posts here on DEV, rather than mostly pointing to an external link. Doing so helps ensure that readers don’t have to jump around to too many different pages, and it helps focus the conversation right here in the comments section.

If you choose to do so, you also have the option to add a canonical URL directly to your post.

Collapse
hugekontrast profile image
Ashish Khare😎

Where is the build process written? Log your journey and tips you discovered while creating this.

Collapse
aman2221 profile image
Aman Singh Author

I had learned many things

first of all, I created this project because I wanted to revise CSS and js
and I have also learned how to build logic for this kind of project now I'm going to create typing speed test website

Collapse
hugekontrast profile image
Ashish Khare😎

Great and good for you. But instead of writing this in here, you could have mentioned your key takeaways in the post itself. Try doing this in your next post. I mean to tell about the whole tech stack you used, react, tailwind, or others, scribble about your build process, you could even warn about certain shortcomings you faced while developing, or if you don't want to take the long road, you can simply make a small TLDR table just for the postulates of your approach. Thanks for sharing and keep reporting your progress!

Thread Thread
aman2221 profile image
Aman Singh Author

Thank you so much ❤️️ , Ashish it means a lot to me
from next time I'll definitely take care of these things .