Code Monkey home page Code Monkey logo

Comments (1)

zeh avatar zeh commented on May 24, 2024 2

Hey @burdakovd,

(Sorry, for some reason I missed this issue report before, and only saw it now)

Thanks for your report.

  1. You're right, empty strings are producing an invalid internal seed (0). The same was true of a passed seed of value 0; they cannot be shifted so the generator gets stuck. I've fixed this issue. Seed generation is a bit safer now, recovering from cases like that (simply setting the seed to 1).
  2. I actually agree with you on the string seed issue. Strings with a very close alphanumeric similarity like "41" and "42" would produce a close hash, because it was just a char code count. I didn't want to employ any big third-party hashing algorithm because I wanted to make the library small, but it's clear the current solution was not good enough in real world applications. I've added a change that now passes the string-based hash through the internal xorshifter function, therefore making the string hash result more random-looking. This is a breaking change since the same string seeds now produce different internal seeds.

Both changes are now part of the 4.0.0 release, a major bump due to the breaking changes.

Thanks again!

from prando.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.