Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit cbff3c3

Browse files
committed
Make Marvin use RNG.Fill
1 parent b5bfff0 commit cbff3c3

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Common/src/System/Marvin.cs

+3-6
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,9 @@ private static uint _rotl(uint value, int shift)
107107

108108
private static ulong GenerateSeed()
109109
{
110-
using (RandomNumberGenerator rng = RandomNumberGenerator.Create())
111-
{
112-
var bytes = new byte[sizeof(ulong)];
113-
rng.GetBytes(bytes);
114-
return BitConverter.ToUInt64(bytes, 0);
115-
}
110+
Span<byte> bytes = stackalloc byte[sizeof(ulong)];
111+
RandomNumberGenerator.Fill(bytes);
112+
return BitConverter.ToUInt64(bytes);
116113
}
117114
}
118115
}

0 commit comments

Comments
 (0)