System.Random.Range code example Example: c# random number Random rnd = new Random(); int number = rnd.Next(1, 10);