diff --git a/source/Cosmos.System2_Plugs/System/RandomImpl.cs b/source/Cosmos.System2_Plugs/System/RandomImpl.cs index 368d989531..ae03b89e0d 100644 --- a/source/Cosmos.System2_Plugs/System/RandomImpl.cs +++ b/source/Cosmos.System2_Plugs/System/RandomImpl.cs @@ -172,6 +172,19 @@ public static void NextBytes(Random aThis, byte[] buffer) } } + public static void NextBytes(Random aThis, Span buffer) + { + if (buffer == null) + { + return; + } + + for (int i = 0; i < buffer.Length; i++) + { + buffer[i] = (byte)(InternalSample() % (byte.MaxValue + 1)); + } + } + public static double NextDouble(Random aThis) { return Sample();