-
-
Save donyd/1275c2ea2ef364325b3344261775d8c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace WhoGoesNext | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// starting variables | |
int randomNumberGiven = 46; | |
int currentPlayer = 0; | |
int numberOfPlayers = 4; | |
int nextRandomNumber = 0; | |
// get next player based on random received | |
currentPlayer = randomNumberGiven % numberOfPlayers; | |
// get next random number | |
nextRandomNumber = getNextRandom(); | |
Console.WriteLine("Player {0}'s turn", currentPlayer); | |
Console.WriteLine("Next random number is: {0}", nextRandomNumber); | |
Console.ReadLine(); | |
} | |
private static int getNextRandom() | |
{ | |
// create random seed | |
Random rand = new Random(); | |
// return random number with limit 99 | |
return rand.Next(99); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment