Skip to content

Integer division where floating division is correct #2

@rodc2

Description

@rodc2

To match the output of the source 0.3.0 javascript, (Hashids method):
if (!this.seps.length || (this.alphabet.length / this.seps.length) > this.sepDiv) {
in C# is:
if ((Separators.Length == 0) || (((double)Alphabet.Length / (double)Separators.Length) > sepDivisor)) ( / is integer division in c# if both sides are integers, but floating division in javascript)
Without this, some combinations of alphabets and separators will yield results which do not match the javascript results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions