fix: Fixes negative random numbers (#1600)
This commit is contained in:
parent
dba3ec2db5
commit
b5c984e5de
3 changed files with 6 additions and 6 deletions
|
|
@ -1236,13 +1236,13 @@ public static class Utility
|
|||
public static int Random(int from, int count) => BuiltInRng.Next(from, count);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int Random(int count) => BuiltInRng.Next(count);
|
||||
public static int Random(int count) => count < 0 ? -BuiltInRng.Next(-count) : BuiltInRng.Next(count);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static long Random(long from, long count) => BuiltInRng.Next(from, count);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static long Random(long count) => BuiltInRng.Next(count);
|
||||
public static long Random(long count) => count < 0 ? -BuiltInRng.Next(-count) : BuiltInRng.Next(count);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void RandomBytes(Span<byte> buffer) => BuiltInRng.NextBytes(buffer);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue