public MainServer() //Main Thread
    {
        Console.WriteLine("MainServer started.");
        Thread.CurrentThread.Name = "mainServer";

        ServerCreater serverCreater = new ServerCreater();

        serverCreater.First2ServerCreater(); //at start we run two subserver thread
        Thread.Sleep(100);
        while (true)
        {
            Thread.Sleep(100);                                              //100+100=200ms
            RandomGenerator rand1 = new RandomGenerator();
            ServerLoads.mainAmount = ServerLoads.mainAmount - rand1.number; //responds randomly
            if (ServerLoads.mainAmount < 0)
            {
                ServerLoads.mainAmount = 0; //server load cannot be negative
            }

            Thread.Sleep(200);
            RandomGenerator rand2 = new RandomGenerator();
            ServerLoads.mainAmount = ServerLoads.mainAmount - rand2.number; //responds randomly
            if (ServerLoads.mainAmount < 0)
            {
                ServerLoads.mainAmount = 0; //server load cannot be negative
            }

            Thread.Sleep(100); //200+200+100=500ms
            //Generate random(1-100) number in every 500ms
            RandomGenerator100 rand100 = new RandomGenerator100();
            ServerLoads.mainAmount = ServerLoads.mainAmount + rand100.number;
            if (ServerLoads.mainAmount > capacity)
            {
                ServerLoads.mainAmount = capacity; //server cannot take more load than its capacity
            }

            Thread.Sleep(100);                                              //100+100=200ms
            RandomGenerator rand3 = new RandomGenerator();
            ServerLoads.mainAmount = ServerLoads.mainAmount - rand3.number; //responds randomly
            if (ServerLoads.mainAmount < 0)
            {
                ServerLoads.mainAmount = 0; //server load cannot be negative
            }
        }
    }
    public MainServer() //Main Thread
    {
        Console.WriteLine("MainServer started.");
        Thread.CurrentThread.Name = "mainServer";

        ServerCreater serverCreater = new ServerCreater();

        serverCreater.First2ServerCreater();
        Thread.Sleep(100);
        while (true)
        {
            Thread.Sleep(100); //100+100=200ms
            RandomGenerator rand1 = new RandomGenerator();
            ServerLoads.mainAmount = ServerLoads.mainAmount - rand1.number;
            if (ServerLoads.mainAmount < 0)
            {
                ServerLoads.mainAmount = 0;
            }

            Thread.Sleep(200);
            RandomGenerator rand2 = new RandomGenerator();
            ServerLoads.mainAmount = ServerLoads.mainAmount - rand2.number;
            if (ServerLoads.mainAmount < 0)
            {
                ServerLoads.mainAmount = 0;
            }

            Thread.Sleep(100); //200+200+100=500ms
            //Generate random(1-100) number in every 500ms
            RandomGenerator100 rand100 = new RandomGenerator100();
            ServerLoads.mainAmount = ServerLoads.mainAmount + rand100.number;
            if (ServerLoads.mainAmount > capacity)
            {
                ServerLoads.mainAmount = capacity;
            }

            Thread.Sleep(100); //100+100=200ms
            RandomGenerator rand3 = new RandomGenerator();
            ServerLoads.mainAmount = ServerLoads.mainAmount - rand3.number;
            if (ServerLoads.mainAmount < 0)
            {
                ServerLoads.mainAmount = 0;
            }
        }
    }