mardi 4 octobre 2016

How to get random two times

I start learning c#. I try to create strange game but i didn't make random into random that is to say two time random. I tried to do random two times but i don't do. Bug is |x | or | x| don't show, work. (For c#) How can i do this? I want random into random.

  static void randomata()
    {
        Random r = new Random();
        Random r2 = new Random();
        Random r3 = new Random();
        Random r4 = new Random();
        int randomsonuc = r.Next(0, 100);
        int randomsonuc2 = r2.Next(0, 100);
        int randomsonuc3 = r3.Next(0, 100);
        int randomsonuc4 = r4.Next(0, 100);
        if (randomsonuc < 90) // work
        {
            if (randomsonuc2 < 50) // work
            {
                cmake("|XX|", 8, 0);
            }
            else if(randomsonuc2 >= 50) //work
            {
                cmake("|X|", 8, 0);
                cmake("|X|", 8, 1);
            }
        }
       else if (randomsonuc >= 90 && randomsonuc < 95) // work
        {
            if (randomsonuc3 < 50) // doesnt work
            {
                cmake("|X |", 8, 0);
            }
            if (randomsonuc3 >= 50) // work
            {
                cmake("|X|", 8, 0);
                cmake("| |", 8, 1);
            }
        }
        else //(randomsonuc >= 95 && randomsonuc < 100) // work
        {
            if (randomsonuc4 < 50) // doesnt work
            {
                cmake("| X|", 8, 0);
            }
            if (randomsonuc4 >= 50) // work
            {
                cmake("| |", 8, 0);
                cmake("|X|", 8, 1);
            }
        }
    }




Aucun commentaire:

Enregistrer un commentaire