flip a coind code example
Example 1: coin flip
#Ruby
def coin_flip(num_of_flips = 1)
array = ["heads","tails"]
num_of_flips.times do
puts out_come = array[rand(0..1)]
end
end
coin_flip() # You can set the number of times you flip it ;)
Example 2: coin flip
//Use this at the top
using System;
//Put this under code
Random rnd = new Random();
string Answer = "Head";
if (rnd.Next(0,2) == 1)
{
Answer = "Tails" ;
}