dimanche 28 mars 2021

How to store instances of an integer in an array in a separate variable in C#?

I am trying to make a C# program that picks a random number from 1 to 6 and stores it in an array. How to find the instances of a specific number from 1 to 6?

using System;

namespace DiceProbabilityCalc
{
    class Program
    {
        static void Main(string[] args)
        {
            Random rnd = new Random();
            int[] instanceCount = new int[1000];

            for (int i = 0; i < 999; i++)
            {
                int num = rnd.Next(1, 7);
                instanceCount[i] = num;
            }
        }
    }
}




Aucun commentaire:

Enregistrer un commentaire