From ae4f7f7b380ce45e878bc1e0329e6105b29308e2 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sat, 16 Nov 2019 11:02:20 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Call=20OneOf()=20overload=20to?= =?UTF-8?q?=20reduce=20duplication?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- X10D/RandomExtensions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/X10D/RandomExtensions.cs b/X10D/RandomExtensions.cs index 1f88da0..2503418 100644 --- a/X10D/RandomExtensions.cs +++ b/X10D/RandomExtensions.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; + using System.Linq; #endregion @@ -28,7 +29,7 @@ /// The collection to draw from. /// Returns a random element of type from . public static T OneOf(this Random random, params T[] source) => - source[random.Next(source.Length)]; + source.ToList().OneOf(random); /// /// Returns a random element from using the instance.