Answers for "c# pick a random item from array"

C#
8

random from list c#

list[Random.Range(0, list.Count)];
Posted by: Guest on March-22-2020
0

c# pick a random item from array

string[] names = new string[] { "name1", "name2", "name3" };
Random rnd = new Random();
int index = rnd.Next(names.Length);
Console.WriteLine($"Name: {names[index]}");
Posted by: Guest on October-28-2020

Code answers related to "c# pick a random item from array"

C# Answers by Framework

Browse Popular Code Answers by Language