Skip to content

mod/remainder #12

@m-bock

Description

@m-bock

I came across this while trying to port this library to another language:

mkSeed

  1. To me it looks like ensureBetween assumes mod behaves like remainder/%. If mod is used, the extra check in the if condition seems to be redundant.

  2. Does it take min into account?

  3. It seems to not include max in the range

As we know seedMax and seedMin are positve, maybe something simpler would work:
seedMin + (mod n (seedMax - seedMin))

(and this would still not include the seedMax, maybe define seedMax = lcgM instead)

lcgPerturb

it produces invalid seeds when a negative value is passed as a first argument. I think changing remainder/% to mod may fix this.

Hope this is helpful, don't have the time to provide more accurate test examples.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething that should function correctly isn't.type: enhancementA new feature or addition.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions