Files
SVSimServer/SVSim.BattleEngine/Rng/IRandomSource.cs
gamer147 c77d789558 feat(rng-seam): IRandomSource interface + RandomSourceBridge arithmetic
Adds the RNG seam skeleton (Task 1 of M12): IRandomSource (NextUnit/NextSelf)
and RandomSourceBridge.Range mirroring BattleManagerBase.StableRandom exactly
(`(int)Math.Floor(val * unit)`). RngSeamTests pins the floor arithmetic (1 test, passing).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06 10:14:50 -04:00

15 lines
650 B
C#

namespace SVSim.BattleEngine.Rng
{
// The battle RNG seam. The headless authoritative mgr (HeadlessBattleMgr) routes the engine's
// StableRandom* calls through this instead of the IsForecast-gated System.Random fields, so the
// server rolls real outcomes (decoupling F2) and tests can replay a known sequence.
public interface IRandomSource
{
// Synced stream, [0,1). Drives StableRandom (via RandomSourceBridge.Range) and StableRandomDouble.
double NextUnit();
// Self-only stream, [0,max). Mirrors StableRandomOnlySelf (engine: _stableRandomOnlySelf.Next(val)).
int NextSelf(int max);
}
}