From 8c399145474d2aad94fafc93c230489ccc107a4b Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sat, 16 Nov 2019 11:01:00 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20Random.CoinToss()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CoinToss() returns true if the next random number == 2, false otherwise --- X10D/RandomExtensions.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/X10D/RandomExtensions.cs b/X10D/RandomExtensions.cs index 96f23fb..1f88da0 100644 --- a/X10D/RandomExtensions.cs +++ b/X10D/RandomExtensions.cs @@ -12,6 +12,14 @@ /// public static class RandomExtensions { + /// + /// Returns either or based on 's next + /// generation. + /// + /// The instance. + public static bool CoinToss(this Random random) => + random.Next(2) == 0; + /// /// Returns a random element from using the instance. ///