如何生成随机颜色?

use*_*665 3 c# arrays colors

所以我在c#中乱搞,并想知道如何从数组中生成我的字符串,但是使用随机颜色:

    while (true)
        {
            string[] x = new string[] { "", "", "" };
            Random name = new Random();
            Console.WriteLine((x[name.Next(3)]));
            Thread.Sleep(100);
        }
Run Code Online (Sandbox Code Playgroud)

当我输出x时,我希望它是随机颜色.谢谢

Éri*_*ins 7

// Your array should be declared outside of the loop

string[] x = new string[] { "", "", "" }; 
Random random = new Random();     

// Also you should NEVER have an endless loop ;)
while (true)         
{            
     Console.ForegroundColor = Color.FromArgb(random.Next(255), random.Next(255), random.Next(255));

     Console.WriteLine((x[random.Next(x.Length)]));             
     Thread.Sleep(100);         
} 
Run Code Online (Sandbox Code Playgroud)