From f0651b9d4979c606ebbcde111334979377fce0a7 Mon Sep 17 00:00:00 2001 From: Alan Brault Date: Mon, 27 May 2024 09:42:18 -0400 Subject: [PATCH] refactor: only include random class for targets that require it Signed-off-by: Alan Brault --- src/cuid.net/Utils.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cuid.net/Utils.cs b/src/cuid.net/Utils.cs index cc4bf6c..58fef5a 100644 --- a/src/cuid.net/Utils.cs +++ b/src/cuid.net/Utils.cs @@ -14,7 +14,9 @@ internal static class Utils private const int Radix = 36; +#if NETSTANDARD2_0 || NET472 private static readonly Random Random = new(); +#endif [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static long Decode(ReadOnlySpan input) @@ -70,7 +72,7 @@ internal static string Encode(ulong value) do { ulong c = value % Radix; - buffer[--i] = (char) ( c is >= 0 and <= 9 ? c + 48 : c + 'a' - 10 ); + buffer[--i] = (char) ( c <= 9 ? c + 48 : c + 'a' - 10 ); value /= Radix; } while ( value > 0 );