From db43993d56e01a6d2bb3052330cfc3f3bb37ecd1 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sat, 16 Jan 2021 13:54:42 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20Rename=20Random.CoinToss()=20to?= =?UTF-8?q?=20Random.NextBoolean()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #17 and part of #15 --- X10D/src/RandomExtensions.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/X10D/src/RandomExtensions.cs b/X10D/src/RandomExtensions.cs index 072ab05..a217c83 100644 --- a/X10D/src/RandomExtensions.cs +++ b/X10D/src/RandomExtensions.cs @@ -16,23 +16,25 @@ namespace X10D internal static Random Random { get; } = new Random(); /// - /// Returns either or based on 's next - /// generation. + /// Returns either or based on the next generation of the current + /// . /// /// The instance. /// - /// Returns or depending on the return value - /// from . + /// if the return value from is greater than or + /// equal to 0.5 + /// -or- + /// otherwise. /// /// is . - public static bool CoinToss(this Random random) + public static bool NextBoolean(this Random random) { if (random is null) { throw new ArgumentNullException(nameof(random)); } - return random.Next(2) == 0; + return random.NextDouble() >= 0.5; } ///