Im getting a bug where i call for two ints to get randomly generated by the same method but they always return the same number when releasing the code in debug mode
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kortspil
{
public class Kort
{
public int FåKortNummer()//Get card number
{
System.Random KortNummer = new System.Random();
int kort = KortNummer.Next(1, 14);
ErKortTrukket(kort);//is drawn
return kort;
}
}
class Program
{
static void Main(string[] args)
{
Kort SpillerEt = new Kort();
Kort SpillerTo = new Kort();
int SpillerEtKort = SpillerEt.FåKortNummer();//random number 1
Console.WriteLine("Spiller et har trukket: " + SpillerEtKort.ToString());
int SpillerToKort = SpillerTo.FåKortNummer(); // random number 2
Console.WriteLine("Spiller to har trukket: " + SpillerToKort.ToString());
if (SpillerEtKort <= SpillerToKort)
{
Console.WriteLine("Spiller Et vandt denne runde");//player 1 won this round
}
else
{
Console.WriteLine("Spiller to vandt denne runde");//player 2 won this round
}
Console.WriteLine("Tryk Enter for at lukke...");
Console.ReadLine();
}
}
}