lundi 8 août 2016

C# needing a six digit number beginning with two 0's

I'm making a program where products are searched for by there batch number. I want to the batch number to be a random 6 digit code starting with 00, for example 002142; at the moment it is only making a random 6 digit code. Here is the code I have tried:

 public string getRandomNumber()
    {
        Random random = new Random(100000);
        string randomNumber = random.Next(999999).ToString("D6");
        return randomNumber;
    }




Aucun commentaire:

Enregistrer un commentaire