mercredi 9 novembre 2022

Trying to randomly pick numbers in c# with an action

Sorry for any miswording of anything here I am not a native english speaker I have been trying to randomly pick a number between 1 - 6 in c# and for whatever reason it says System.Func`1[System.Int32] every time I try to print it out (i know usually this is done in main but this is my homework and I was ordered not to put it in main)

namespace ConsoleApp9
{
    






    internal class Program
    {
        static Random random = new Random();


        static void Main(string[] args)
        {
          
          
            Console.WriteLine(GetDice);
        }



        public static int GetDice()
        {
            Random random = new Random();
            int dice = random.Next(1, 100);
            return dice;
           
        
        
        
        }
    }
}



Aucun commentaire:

Enregistrer un commentaire