Skip to content

Conversation

@basukinath
Copy link

  • Fixes a bug where the library selected a single random quote once at module load and returned the same quote for every call.
  • Ensures a fresh random quote is selected on each call to getQuote() and getRandomQuote().
  • Corrects the random index bounds (uses 0..arr.length-1).
  • Adds a small file header attribution: "Contributed by Basuki".

Why this change

  • Users expect random APIs to return different values across calls. The previous behavior was surprising and effectively non-random for the lifetime of the process.
  • The off-by-one in the index generation could potentially select an out-of-range index in some implementations; the fix makes the behavior robust.

@welcome
Copy link

welcome bot commented Oct 3, 2025

Thanks for opening this pull request! 🤗
Wishing you a great Hacktoberfest 2021 🙌 🎉 ⚡️
Are you looking for more beginner-friendly issues? Check out this repo.

Hacktoberfest2021

📢 Spread the word about @vinitshahdeo/Hacktoberfest2021 repo across your social media channels to help get others involved! Give a shoutout to our initiative. Retweet this.

Open Source Love

Check out few other repos below 🚀

PortScanner
SimpleBio
HBD
Map Of India

Show some ❤️

  • Consider leaving a ⭐ here.
  • Check out more beginner-friendly repos here.
  • Follow @vinitshahdeo for more updates.
  • Read my open-source journey here.

Say Hi on Twitter! 👋

Twitter Follow

PS: Please add @vinitshahdeo as a reviewer if you haven't added.

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