This question already has an answer here:
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
Aucun commentaire:
Enregistrer un commentaire