I'm trying to create a scrubbing program and I'm stuck on a bit where I have to generate a set of random numbers to replace a string of numbers and while I can get the random number once, I can't seem to figure out how to make it replace the entire nine character string.
public static int GetRandomNumber()
{
Random rnd = new Random();
// creates a number between 0 and 9
int ranNum = rnd.Next(10);
return ranNum;
}
I know it has something to do with checking against the string length and repeating until it replaces the entire string but I can't for the life of me remember how and googling is a bit too non-specific. The string itself is being pulled from a text file and has been split into an array.
public static string[] ScrubData(string line)
{
string[] words = line.Split('|');
replaceData(words);
MessageBox.Show(words[0] + words[2]);
return words;
}
private static void replaceData(string[] words)
{
words[0] = Convert.ToString(GetRandomNumber());
}
I know someone already asked a similar question, but I have no idea what "lock" is or how to connect their question with mine.