Skip to content

RNG.clone().setSeed() does not function as expected #201

Description

@seiyria

Something I noticed today when porting my code from JS to TS, I wanted to use RNG.clone().setSeed() so I wasn't overriding the global RNG instance, and was using a unique one per map generation. I noticed that this causes inconsistent results in some weird ways. For example, my first few RNG picks match, but everything after that seem to go completely askew. A few notes:

  • my map generator is here - this is not the ported typescript code that I'm using, so it would require a little work to get working to pass an RNG instance around
  • my TS version is here so you can see differences if desired

pictures for comparison:

Orikurnis1-min
Orikurnis2-min

Might not mean a lot - but when I don't do a .clone() I always get the first image. When I clone the RNG before attempting to use it, I get some variation on the second one - it always picks the same 2 or 3 results the same, but then the rest is unpredictable.

Is there something with RNG.clone that's not being copied correctly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions