dotnet-random-ts
v0.1.0
Published
A TypeScript port of .NET Random's explicit-seed compatibility behavior.
Readme
dotnet-random-ts
This project was created to read files generated by .NET that carry seeded random state or depend on seeded System.Random behavior. To make that practical in TypeScript, the library reproduces the explicit-seed compatibility path of .NET Random(int seed).
The current scope is the seeded compatibility implementation, not the default constructor path. At the moment, the library implements and tests these methods:
next()next(maxValue)next(minValue, maxValue)nextDouble()shuffle(values)
The test fixtures are generated from .NET with a single C# file and then committed to the repository. That keeps normal test runs independent from .NET while still making the fixture source reproducible.
Usage
import { Random } from "dotnet-random-ts";
const random = new Random(42);
const a = random.next();
const b = random.next(100);
const c = random.next(-10, 10);
const d = random.nextDouble();
const values = [1, 2, 3, 4, 5];
random.shuffle(values);AI Disclosure
This project is 100% AI-generated.
Scripts
pnpm run generate:fixturespnpm test -- --runpnpm typecheckpnpm build
Notes
- Only the explicit-seed path is implemented.
NextInt64and other 64-bit integer APIs are out of scope for now.
