Skip to content

Instantly share code, notes, and snippets.

@jpetto
Created September 28, 2011 13:57
Show Gist options
  • Save jpetto/1247995 to your computer and use it in GitHub Desktop.
Save jpetto/1247995 to your computer and use it in GitHub Desktop.
C# - Get a random number between 1 and 10
// declare and assign new variable of type Random
Random r = new Random();
// declare an int & assign it a random value between 1 and 10 (inclusive)
int intRandomNumber = r.Next(10) + 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment