diff --git a/RandomExtensions.cs b/RandomExtensions.cs index bc78b59..ba76b6a 100644 --- a/RandomExtensions.cs +++ b/RandomExtensions.cs @@ -5,12 +5,31 @@ namespace Platform.Random { public static class RandomExtensions { + /// + /// Returns a random 64-bit unsigned integer that is greater than or equal to ulong.MinValue, and less than or equal to ulong.MaxValue. + /// Возвращает случайное 64-разрядное целое число без знака, которое больше или равно ulong.MinValue и меньше или равно ulong.MaxValue. + /// + /// A pseudo-random number generator. Генератор псевдослучайных чисел. + /// A 64-bit unsigned integer that is greater than or equal to ulong.MinValue, and less than or equal to ulong.MaxValue. 64-разрядное целое число без знака, которое больше или равно ulong.MinValue и меньше или равно ulong.MaxValue. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ulong NextUInt64(this System.Random rnd) => rnd.NextUInt64(new Range(ulong.MinValue, ulong.MaxValue)); + /// + /// Returns a random 64-bit unsigned integer that is greater than or equal to minimum of specified range, and less than or equal to maximum of specified range. + /// Возвращает случайное 64-разрядное целое число без знака, которое больше или равно минимуму указанного диапазона и меньше или равно максимуму указанного диапазона. + /// + /// A pseudo-random number generator. Генератор псевдослучайных чисел. + /// The range of possible values. Диапазон возможных значений. + /// A 64-bit unsigned integer that is greater than or equal to the minimum of specified range, and less than or equal to the maximum of the specified range. 64-разрядное целое число без знака, которое больше или равно минимуму указанного диапазона и меньше или равно максимуму указанного диапазона. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ulong NextUInt64(this System.Random rnd, Range range) => (ulong)(rnd.NextDouble() * (range.Maximum - range.Minimum)) + range.Minimum; + /// + /// Return a random boolean value. + /// Возвращает случайное булево значение. + /// + /// A pseudo-random number generator. Генератор псевдослучайных чисел. + /// A random boolean value. Случайное булево значение. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool NextBoolean(this System.Random rnd) => rnd.Next(2) == 1; } diff --git a/RandomHelpers.cs b/RandomHelpers.cs index 0324b07..e7fc264 100644 --- a/RandomHelpers.cs +++ b/RandomHelpers.cs @@ -2,6 +2,10 @@ { public static class RandomHelpers { + /// + /// Returns the pseudorandom number generator that is using the time of the first access to this field as seed. + /// Возвращает генератор псевдослучайных чисел использующий в качестве seed время первого обращения к этому полю. + /// public static readonly System.Random Default = new System.Random(System.DateTime.UtcNow.Ticks.GetHashCode()); } }