To flip a coin in C# or VB.NET you just need to use this extension method on a instance of random.
Extension Method C#
public static bool FlipCoin(this Random rand) { return rand.Next(2) == 0; }
Extension Method VB.NET
<System.Runtime.CompilerServices.Extension> _ Public Shared Function FlipCoin(rand As Random) As Boolean Return rand.Next(2) = 0 End Function
RT @CodeSnippetsNET: How to flip a coin in C# or http://t.co/85naMTtT4u: http://t.co/JqAAGgvpOm #csharp #programming #vb #dotnet