2

can any help me with random string generator. I need to generate string with count of numbers and alphacharacters?

now i have this:

private static readonly Random Random = new Random((int)DateTime.Now.Ticks);
    private static string _alphaChars = "qwertyuiopasdfghjklzxcvbnm";
    private static string _numericChars = "1234567890";
    private static string RandomString(int size, string avaliable)
    {
        var chars = Enumerable.Range(0, size).Select(x => avaliable[Random.Next(0, avaliable.Length)]);
        return new string(chars.ToArray());
    }

but i need change this function to get parameters with count of numeric and alpha, and get string with this count? how i can do this? I need thay my string contains always, for example: with 4 alpha chars and 2 numeric. Count of this thinks must be like parameters

NoNameR
  • 85
  • 12
  • 1
    `with count of numbers and alphacharacters` what does this means ? Do you mean you need a string that is composite of mixture of letters and digits ? – Orel Eraki Jul 20 '15 at 12:12
  • check below link: [http://stackoverflow.com/questions/1344221/how-can-i-generate-random-alphanumeric-strings-in-c][1] [1]: http://stackoverflow.com/questions/1344221/how-can-i-generate-random-alphanumeric-strings-in-c – VIPUL PARMAR Jul 20 '15 at 12:14
  • updated my post, look in the end – NoNameR Jul 20 '15 at 12:18

0 Answers0