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>
This commit is contained in:
13
SVSim.BattleEngine/Rng/RandomSourceBridge.cs
Normal file
13
SVSim.BattleEngine/Rng/RandomSourceBridge.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace SVSim.BattleEngine.Rng
|
||||
{
|
||||
// The ONE place engine roll-logic is re-authored (the virtual-override seam restates it rather than
|
||||
// body-patching the Engine file). Isolated here so it is unit-testable and pinned to the verbatim
|
||||
// engine by the parity test (RngSeamTests.SeededSource_matches_engine_generator / Task 5). Mirrors
|
||||
// BattleManagerBase.StableRandom: `(int)Math.Floor((double)val * unit)`.
|
||||
public static class RandomSourceBridge
|
||||
{
|
||||
public static int Range(int val, double unit) => (int)Math.Floor((double)val * unit);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user