diff --git a/X10D/src/RandomExtensions/RandomExtensions.cs b/X10D/src/RandomExtensions/RandomExtensions.cs index 1b9800c..1b7d357 100644 --- a/X10D/src/RandomExtensions/RandomExtensions.cs +++ b/X10D/src/RandomExtensions/RandomExtensions.cs @@ -179,87 +179,6 @@ public static class RandomExtensions return list[random.Next(list.Count)]; } - /// - /// Returns a random 64-bit integer. - /// - /// The instance. - /// - /// A 64-bit signed integer greater than or equal to 0 and less than . - /// - /// is . - public static long NextInt64(this Random random) - { - if (random is null) - { - throw new ArgumentNullException(nameof(random)); - } - - int sample = random.Next(); - var sampledRandom = new Random(sample); - return ((long)sample << 32) | (uint)sampledRandom.Next(); - } - - /// - /// Returns a non-negative random 64-bit integer that is less than the specified maximum. - /// - /// The instance. - /// The exclusive upper bound of the random number returned. - /// - /// A 64-bit signed integer that is greater than or equal to 0, and less than ; that is, - /// the range of return values ordinarily includes 0 but not . However, if - /// equals 0, is returned. - /// - /// must be greater than or equal to 0. - /// is . - /// is less than 0. - public static long NextInt64(this Random random, long maxValue) - { - if (random is null) - { - throw new ArgumentNullException(nameof(random)); - } - - if (maxValue < 0) - { - throw new ArgumentOutOfRangeException(nameof(maxValue), ExceptionMessages.MaxValueGreaterThanEqualTo0); - } - - return random.NextInt64(0, maxValue); - } - - /// - /// Returns a random 64-bit integer that is within a specified range. - /// - /// The instance. - /// The inclusive lower bound of the random number returned. - /// The exclusive upper bound of the random number returned. - /// - /// A 64-bit signed integer greater than or equal to and less than - /// ; that is, the range of return values includes but not - /// . If equals , - /// is returned. - /// - /// must be greater than or equal to . - /// is . - /// - /// is less than . - /// - public static long NextInt64(this Random random, long minValue, long maxValue) - { - if (random is null) - { - throw new ArgumentNullException(nameof(random)); - } - - if (maxValue < minValue) - { - throw new ArgumentOutOfRangeException(nameof(maxValue), ExceptionMessages.MaxValueGreaterThanEqualToMinValue); - } - - long sample = random.NextInt64(); - return (sample % (maxValue - minValue)) + minValue; - } - /// /// Returns a random single-precision floating point number between 0 and 1. ///