[Bug] Move correlated path generation onto the shared deterministic RNG

Open
#1,435 3 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 2 days

@stan545 is already working on this.

Since Nov 20, 2026.

  • #1471 by @stan545 — open

Assessment

This issue has not been assessed yet.

Description

bug medium sdk Stellar Wave testing

Summary

Make the correlated path generator use the shared XorShift64 RNG and fixed-point price arithmetic.

Motivation

correlated-paths.ts uses a mulberry32 generator and JavaScript floats, while the shared GBM path uses XorShift64 and fixed-point operations. The same seed can therefore diverge between the two generators, which breaks reproducible multi-asset scenarios.

Proposed Solution

  • Replace the correlated generator's RNG with the shared XorShift64 and derivePathSeed.
  • Move price arithmetic to the shared fixed-point primitives.
  • Keep Cholesky validation and the output shape.
  • Add a golden fixture that pins the generated paths.

Scope

Field Value
Area Strategies
Protocol affected None
Network testnet and mainnet
Breaking change? No

Alternatives Considered

  • Keep two generators and document the difference. Rejected because a seed should mean one thing.
  • Switch GBM to mulberry32. Rejected because GBM is already fixed point and shared.

Acceptance Criteria

  • The same seed produces identical paths across repeated runs and path indexes.
  • Generation uses XorShift64 and fixed-point prices.
  • A golden fixture pins the paths.
  • Correlation and drift sanity tests pass.
  • Existing API types remain compatible.
  • pnpm lint, pnpm typecheck, and pnpm test pass.

Additional Context

See packages/strategies/src/correlated-paths.ts, packages/strategies/src/gbm.ts, and packages/strategies/src/rng.ts.

Dominant language
TypeScript
Stars
17
Forks
129
Avg merge
3d 13h
Merged PRs (30d)
54

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from drydocs/meridian

All issues in drydocs/meridian

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.